mono-examples: Adapt to latest syntax

Setter and Getters have disappeared. Now everything is accessed through properties like:
Text, Disabled, Autohide, Color, Orientation, ContentPadding, Size, ScrollableText, Align, Name.
Also the Life and Containers examples had several issues.
Text override from custom widgets is still not solved.
This commit is contained in:
Xavi Artigas 2020-02-20 17:09:22 +01:00
parent 6e77c4aae2
commit 5f1be675ee
29 changed files with 172 additions and 170 deletions

View File

@ -48,10 +48,10 @@ public class Calculator : Efl.Csharp.Application
{
if (mustOverwrite)
{
screen.SetText("");
screen.Text = "";
mustOverwrite = false;
}
screen.SetText(screen.GetText() + button.ToString());
screen.Text = screen.Text + button.ToString();
}
else
{
@ -59,7 +59,7 @@ public class Calculator : Efl.Csharp.Application
{
case 'C':
// Clear current input
screen.SetText("0");
screen.Text = "0";
break;
case '+':
case '-':
@ -70,7 +70,7 @@ public class Calculator : Efl.Csharp.Application
if (operation != '=')
{
Operate();
screen.SetText(currValue.ToString());
screen.Text = currValue.ToString();
}
// Store this operation
operation = button;
@ -90,7 +90,7 @@ public class Calculator : Efl.Csharp.Application
private void ScreenChangedCb(object sender, EventArgs ea)
{
string text = "";
string str = screen.GetText();
string str = screen.Text;
int d;
if (str == "" || str == "-")
{
@ -106,7 +106,7 @@ public class Calculator : Efl.Csharp.Application
}
catch {}
}
if (text != str) screen.SetText(text);
if (text != str) screen.Text = text;
}
// Creates an Efl.Ui.Button and positions it in the given position inside the table
@ -128,7 +128,7 @@ public class Calculator : Efl.Csharp.Application
label.TextHorizontalAlign = 0.5;
label.TextVerticalAlign = 0.5;
label.Color = (r, g, b, 255);
label.SetText(text);
label.Text = text;
label.FontFamily = "Sans";
label.FontSize = 36;
button.Content = label;
@ -139,7 +139,7 @@ public class Calculator : Efl.Csharp.Application
{
// The window
var win = new Efl.Ui.Win(Efl.App.AppMain);
win.SetText("EFL Calculator");
win.Text = "EFL Calculator";
win.Autohide = true;
win.VisibilityChangedEvent += GUIQuitCb;
@ -169,7 +169,7 @@ public class Calculator : Efl.Csharp.Application
// Create a big Efl.Ui.Text screen to display the current input
screen = new Efl.Ui.Textbox(table);
screen.SetText("0");
screen.Text = "0";
screen.FontFamily = "Sans";
screen.FontSize = 48;
screen.Multiline = false;

View File

@ -21,7 +21,7 @@ public class LifeWindow : Efl.Csharp.Application
void TouchEvent(object sender, Efl.Input.InterfacePointerDownEventArgs ev)
{
int cellx, celly;
var position = ev.Arg.GetPosition();
var position = ev.Arg.Position;
lifeRender.CellForCoords(win, position, out cellx, out celly);
int i = LifeBoard.IndexForPosition(cellx, celly);
@ -31,15 +31,15 @@ public class LifeWindow : Efl.Csharp.Application
void KeyDownEvent(object sender, Efl.Input.InterfaceKeyDownEventArgs ev)
{
if (ev.Arg.GetKeySym() == "space")
if (ev.Arg.KeySym == "space")
lifeBoard.TogglePause(win);
}
protected override void OnInitialize(string[] args)
{
win = new Efl.Ui.Win(parent: null, winName: "Life", winType: Efl.Ui.WinType.Basic);
win.SetText("EFL Life");
win.SetAutohide(true);
win.Text = "EFL Life";
win.Autohide = true;
// when the user clicks "close" on a window there is a request to hide
((Efl.Gfx.IEntity)win).VisibilityChangedEvent += QuitEvent;
@ -52,8 +52,8 @@ public class LifeWindow : Efl.Csharp.Application
((Efl.Input.IInterface)win).PointerDownEvent += TouchEvent;
((Efl.Input.IInterface)win).KeyDownEvent += KeyDownEvent;
win.SetSize(new Eina.Size2D((int)(10 * LifeBoard.Width * win.GetScale()),
(int)(10 * LifeBoard.Height * win.GetScale())));
win.Size = new Eina.Size2D((int)(10 * LifeBoard.Width * win.Scale),
(int)(10 * LifeBoard.Height * win.Scale));
lifeBoard.Run(win);
}

View File

@ -21,7 +21,7 @@ public class LifeRender
public void CellForCoords(Efl.Ui.Win win, Eina.Position2D coord, out int x, out int y)
{
Eina.Size2D size = win.GetSize();
Eina.Size2D size = win.Size;
x = coord.X * LifeBoard.Width / size.W;
y = coord.Y * LifeBoard.Height / size.H;
@ -29,7 +29,7 @@ public class LifeRender
public void RenderLayout(Efl.Ui.Win win)
{
Eina.Size2D size = win.GetSize();
Eina.Size2D size = win.Size;
double cw = (double) size.W / LifeBoard.Width;
double ch = (double) size.H / LifeBoard.Height;
@ -39,9 +39,9 @@ public class LifeRender
var rect = lifeCells[LifeBoard.IndexForPosition(x, y)];
// the little +1 here will avoid tearing as we layout non-multiple sizes
rect.SetSize(new Eina.Size2D((int)(cw + 1), (int)(ch + 1)));
rect.Size = new Eina.Size2D((int)(cw + 1), (int)(ch + 1));
rect.SetPosition(new Eina.Position2D((int)(x * cw), (int)(y * ch)));
rect.Position = new Eina.Position2D((int)(x * cw), (int)(y * ch));
}
}
@ -51,9 +51,9 @@ public class LifeRender
var rect = lifeCells[i];
if (lifeBoard.Cells[i])
rect.SetColor(0, 0, 0, 255);
rect.Color = (0, 0, 0, 255);
else
rect.SetColor(255, 255, 255, 255);
rect.Color = (255, 255, 255, 255);
}
public void Refresh(Efl.Ui.Win win)

View File

@ -29,8 +29,8 @@ class Application : Efl.Csharp.Application
{
win = new Efl.Ui.Win(parent: null, winName: "MVVM Example",
winType: Efl.Ui.WinType.Basic);
win.SetText("EFL Life");
win.SetAutohide(true);
win.Text = "EFL Life";
win.Autohide = true;
win.VisibilityChangedEvent += QuitEvt;
@ -49,7 +49,7 @@ class Application : Efl.Csharp.Application
list.Factory = factory;
win.SetContent(list);
win.SetSize(new Eina.Size2D(640, 480));
win.Size = new Eina.Size2D(640, 480);
win.Visible = true;
}

View File

@ -42,11 +42,11 @@ public class TextEditor : Efl.Csharp.Application
private void GUIToolbarRefresh()
{
// "New" is enabled if there is text in the text box
toolbarButtonNew.SetDisabled(string.IsNullOrEmpty(editorTextBox.GetText()));
toolbarButtonNew.Disabled = string.IsNullOrEmpty(editorTextBox.Text);
// "Save" is enabled if the text has been modified since last save or load
toolbarButtonSave.SetDisabled(!edited);
toolbarButtonSave.Disabled = !edited;
// "Load" is enabled if there is a file to load
toolbarButtonLoad.SetDisabled(!System.IO.File.Exists(filename));
toolbarButtonLoad.Disabled = !System.IO.File.Exists(filename);
}
// Called when the text in the editor has changed
@ -60,8 +60,8 @@ public class TextEditor : Efl.Csharp.Application
private void ShowMessage(string message)
{
var popup = new Efl.Ui.AlertPopup (win);
popup.SetScrollableText(message);
popup.SetHintSizeMax(new Eina.Size2D(200, 200));
popup.ScrollableText = message;
popup.HintSizeMax = new Eina.Size2D(200, 200);
popup.SetButton(Efl.Ui.AlertPopupButton.Positive, "OK", null);
popup.ButtonClickedEvent +=
(object sender, Efl.Ui.AlertPopupButtonClickedEventArgs ea) => {
@ -75,9 +75,9 @@ public class TextEditor : Efl.Csharp.Application
string iconName, EventHandler<Efl.Input.ClickableClickedEventArgs> func)
{
var button = new Efl.Ui.Button(toolbar);
button.SetText(name);
button.Text = name;
button.ClickedEvent += func;
button.SetHintWeight(0, 1);
button.HintWeight = (0, 1);
// Set the content of the button, which is an image
var image = new Efl.Ui.Image(toolbar);
@ -96,15 +96,15 @@ public class TextEditor : Efl.Csharp.Application
// 0 vertical weight means that the toolbar will have the minimum height
// to accommodate all its buttons and not a pixel more. The rest of the
// space will be given to the other object in the parent container.
bar.SetHintWeight(1, 0);
bar.SetOrientation(Efl.Ui.LayoutOrientation.Horizontal);
bar.HintWeight = (1, 0);
bar.Orientation = Efl.Ui.LayoutOrientation.Horizontal;
parent.Pack(bar);
// "New" button
toolbarButtonNew = GUIToolbarButtonAdd(bar, "New", "document-new",
(object sender, Efl.Input.ClickableClickedEventArgs ea) => {
// When this button is clicked, remove content and refresh toolbar
editorTextBox.SetText("");
editorTextBox.Text = "";
GUIToolbarRefresh();
});
@ -113,7 +113,7 @@ public class TextEditor : Efl.Csharp.Application
(object sender, Efl.Input.ClickableClickedEventArgs ea) => {
// When this button is clicked, try to save content and refresh toolbar
try {
System.IO.File.WriteAllText(filename, editorTextBox.GetText());
System.IO.File.WriteAllText(filename, editorTextBox.Text);
edited = false;
GUIToolbarRefresh();
ShowMessage("Saved!");
@ -128,7 +128,7 @@ public class TextEditor : Efl.Csharp.Application
(object sender, Efl.Input.ClickableClickedEventArgs ea) => {
// When this button is clicked, try to load content and refresh toolbar
try {
editorTextBox.SetText(System.IO.File.ReadAllText(filename));
editorTextBox.Text = System.IO.File.ReadAllText(filename);
edited = false;
GUIToolbarRefresh();
ShowMessage("Loaded!");
@ -155,8 +155,8 @@ public class TextEditor : Efl.Csharp.Application
{
// Create a window and initialize it
win = new Efl.Ui.Win(parent: Efl.App.AppMain);
win.SetText("Text Editor");
win.SetAutohide(true);
win.Text = "Text Editor";
win.Autohide = true;
win.VisibilityChangedEvent += GUIQuitCb;
// Create a vertical box container
@ -173,7 +173,7 @@ public class TextEditor : Efl.Csharp.Application
editorTextBox.Multiline = true;
editorTextBox.Editable = true;
editorTextBox.Scrollable = true;
editorTextBox.SetHintSizeMin(new Eina.Size2D(360, 240));
editorTextBox.HintSizeMin = new Eina.Size2D(360, 240);
editorTextBox.ChangedEvent += EditorChangedCb;
editorTextBox.ChangedUserEvent += EditorChangedCb;
box.Pack(editorTextBox);

View File

@ -12,21 +12,21 @@ public class Example : Efl.Csharp.Application
// Polling callback
private static void PollCb(object sender, EventArgs e)
{
Console.WriteLine(" Poll from {0}", ((Efl.Object)sender).GetName());
Console.WriteLine(" Poll from {0}", ((Efl.Object)sender).Name);
}
protected override void OnInitialize(string[] args)
{
// Retrieve the application's main loop
var mainloop = Efl.App.AppMain;
mainloop.SetName("Mainloop");
mainloop.Name = "Mainloop";
// This event gets triggered continuously
mainloop.PollHighEvent += PollCb;
// This timer will control events fired by the main loop
var timer = new Efl.LoopTimer(mainloop, 0.1);
timer.SetName("Timer");
timer.Name = "Timer";
// To count number of timer triggers
int tick_count = 0;
timer.TimerTickEvent += (object sender, EventArgs e) => {
@ -46,7 +46,7 @@ public class Example : Efl.Csharp.Application
mainloop.Quit(new Eina.Value(0));
break;
}
Console.WriteLine(message, tick_count, ((Efl.Object)sender).GetName());
Console.WriteLine(message, tick_count, ((Efl.Object)sender).Name);
tick_count++;
};

View File

@ -1,6 +1,6 @@
Efl.Ui.Bg bg = new Efl.Ui.Bg(parent);
bg.SetColor(66, 162, 206, 255);
bg.Color = (66, 162, 206, 255);
bg.SetFile(image_path + "background.png");
bg.Load();

View File

@ -1,9 +1,9 @@
Efl.Ui.Button button = new Efl.Ui.Button(parent);
button.SetText("Test Button");
button.Text = "Test Button";
button.ClickedEvent += (sender, args) =>
{
Efl.Ui.Button btn = (Efl.Ui.Button)sender;
btn.SetText("Clicked");
btn.Text = "Clicked";
};

View File

@ -1,6 +1,6 @@
Efl.Ui.Check check = new Efl.Ui.Check(parent);
check.SetText("Test Check");
check.Text = "Test Check";
check.SetSelected(true);
check.SelectedChangedEvent += (sender, args) =>

View File

@ -2,7 +2,7 @@ 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.Text = "Click to hide the popup";
button.ClickedEvent += (sender, args) =>
{

View File

@ -3,7 +3,7 @@ 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.Text = "Choice no. " + i;
radio.SetStateValue(i);
radioBox.Pack(radio);
}

View File

@ -3,7 +3,7 @@ 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.HintSizeMin = new Eina.Size2D(1000, 1000);
image.SetFile(image_path + "image.png");
image.Load();

View File

@ -1,6 +1,6 @@
Efl.Ui.SpinButton spinButton = new Efl.Ui.SpinButton(parent);
spinButton.SetOrientation(Efl.Ui.LayoutOrientation.Vertical);
spinButton.Orientation = Efl.Ui.LayoutOrientation.Vertical;
spinButton.SetRangeLimits(0, 100);
spinButton.SetRangeStep(2);

View File

@ -1,8 +1,8 @@
var win = new Efl.Ui.Win(Efl.App.AppMain);
win.SetWinType(Efl.Ui.WinType.Basic);
win.SetText("Hello World");
win.SetAutohide(true);
win.Text = "Hello World";
win.Autohide = true;
win.VisibilityChangedEvent +=
(sender, args) => { };

View File

@ -4,15 +4,15 @@ public class Example : Efl.Csharp.Application
{
public static void FocusChangedCb(object sender, EventArgs e)
{
Console.WriteLine($"Focus for object {((Efl.IText)sender).GetText()} changed to {((Efl.Ui.Widget)sender).GetFocus()}");
Console.WriteLine($"Focus for object {((Efl.IText)sender).Text} changed to {((Efl.Ui.Widget)sender).Focus}");
}
protected override void OnInitialize(string[] args)
{
// Create a window and initialize it
var win = new Efl.Ui.Win(null, winType: Efl.Ui.WinType.Basic);
win.SetText("Focus example");
win.SetAutohide(true);
win.Text = "Focus example";
win.Autohide = true;
win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
// Exit the EFL main loop
if (e.Arg == false)
@ -22,16 +22,16 @@ public class Example : Efl.Csharp.Application
// Create the main box container
var vbox = new Efl.Ui.Box(win);
vbox.SetHintSizeMin(new Eina.Size2D(360, 240));
win.SetContent(vbox);
vbox.HintSizeMin = new Eina.Size2D(360, 240);
win.Content = vbox;
// Create some check boxes
Efl.Ui.Check first_checkbox = null;
for (int i = 0; i< 5; i++) {
var checkbox = new Efl.Ui.Check(vbox);
checkbox.SetText("Check " + i);
checkbox.SetHintFill(false, false);
checkbox.SetHintAlign(0.5, 0.5);
checkbox.Text = "Check " + i;
checkbox.HintFill = (false, false);
checkbox.HintAlign = ((Efl.Gfx.Align)0.5, (Efl.Gfx.Align)0.5);
checkbox.FocusChangedEvent += FocusChangedCb;
vbox.Pack(checkbox);
if (i == 0) first_checkbox = checkbox;
@ -39,12 +39,12 @@ public class Example : Efl.Csharp.Application
// Create an horizontal box to contain the two buttons
var hbox = new Efl.Ui.Box(vbox);
hbox.SetOrientation(Efl.Ui.LayoutOrientation.Horizontal);
hbox.Orientation = Efl.Ui.LayoutOrientation.Horizontal;
vbox.Pack(hbox);
// Create a "Focus Mover" button
var button = new Efl.Ui.Button(hbox);
button.SetText("Focus mover");
button.Text = "Focus mover";
button.FocusChangedEvent += FocusChangedCb;
button.ClickedEvent += (object sender, Efl.Input.ClickableClickedEventArgs e) => {
Console.WriteLine("Clicked Focus Mover");
@ -55,7 +55,7 @@ public class Example : Efl.Csharp.Application
// Create a Quit button
button = new Efl.Ui.Button(hbox);
button.SetText("Quit");
button.Text = "Quit";
button.FocusChangedEvent += FocusChangedCb;
button.ClickedEvent += (object sender, Efl.Input.ClickableClickedEventArgs e) => {
Console.WriteLine("Clicked Quit");
@ -64,7 +64,7 @@ public class Example : Efl.Csharp.Application
hbox.Pack(button);
// Show the focus highlight
win.SetFocusHighlightEnabled(true);
win.FocusHighlightEnabled = true;
}
#if WIN32

View File

@ -14,17 +14,17 @@ public class Example : Efl.Csharp.Application
{
Efl.Ui.Box box = new Efl.Ui.Box(win);
// Set distance between contained elements
box.SetContentPadding(5, 0);
box.ContentPadding = (5, 0);
for (int i = 1; i <= 4; ++i)
{
// Add 4 buttons, one below the other
var button = new Efl.Ui.Button(win);
button.SetText($"Boxed {i}");
button.Text = $"Boxed {i}";
if (i == 2)
{
// Button 2 has its maximum size limited, so it will be smaller
button.SetHintSizeMax(new Eina.Size2D(100,50));
button.HintSizeMax = new Eina.Size2D(100,50);
}
box.Pack(button);
}
@ -37,21 +37,21 @@ public class Example : Efl.Csharp.Application
{
Efl.Ui.Table table = new Efl.Ui.Table(win);
// Table with two columns, that get filled left to right, and then top to bottom
table.SetTableColumns(2);
table.SetOrientation(Efl.Ui.LayoutOrientation.Horizontal);
table.TableColumns = 2;
table.Orientation = Efl.Ui.LayoutOrientation.Horizontal;
Efl.Ui.Button button;
for (int i = 1; i <= 4; ++i)
{
// Add 4 buttons, following the defined table flow
button = new Efl.Ui.Button(win);
button.SetText($"Table {i}");
button.Text = $"Table {i}";
table.Pack(button);
}
// Last button spans two table cells
button = new Efl.Ui.Button(win);
button.SetText("Long Button");
button.Text = "Long Button";
table.PackTable(button, 0, 2, 2, 1);
return table;
@ -61,8 +61,8 @@ public class Example : Efl.Csharp.Application
{
// Create a window and initialize it
Efl.Ui.Win win = new Efl.Ui.Win(null, winType: Efl.Ui.WinType.Basic);
win.SetText("Container demo");
win.SetAutohide(true);
win.Text = "Container demo";
win.Autohide = true;
win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
// Exit the EFL main loop
if (e.Arg == false)
@ -70,22 +70,22 @@ public class Example : Efl.Csharp.Application
};
// Give the window an initial size so there is room to resize the panes.
// Otherwise, all widgets are tightly packed
win.SetSize(new Eina.Size2D(350,250));
win.Size = new Eina.Size2D(350,250);
// Create a vertically-split panes container
Efl.Ui.Panes vsplit = new Efl.Ui.Panes(win);
vsplit.SetSplitRatio(0.75);
win.SetContent(vsplit);
vsplit.SplitRatio = 0.75;
win.Content = vsplit;
// Create some boxes and set them as the content of the first pane of the container
var box = CreateBox(win);
vsplit.FirstPart.SetContent(box);
vsplit.FirstPart.Content = box;
// Create a second, horizontally-split panes container and set it as the content of
// the second pane of the first container
Efl.Ui.Panes hsplit = new Efl.Ui.Panes(win);
hsplit.SetOrientation(Efl.Ui.LayoutOrientation.Horizontal);
hsplit.SetSplitRatio(0.85);
hsplit.Orientation = Efl.Ui.LayoutOrientation.Horizontal;
hsplit.SplitRatio = 0.85;
vsplit.SecondPart.SetContent(hsplit);
// Create a table and set it as the content of the first pane of the horizontal
@ -96,8 +96,8 @@ public class Example : Efl.Csharp.Application
// Create a button and set it as the content of the second pane of the horizontal
// container
Efl.Ui.Button quit_btn = new Efl.Ui.Button(win);
quit_btn.SetText("Quit");
quit_btn.SetHintSizeMax(new Eina.Size2D(150, 30));
quit_btn.Text = "Quit";
quit_btn.HintSizeMax = new Eina.Size2D(150, 30);
quit_btn.ClickedEvent += (object sender, Efl.Input.ClickableClickedEventArgs e) => {
// Exit the EFL main loop
Efl.Ui.Config.Exit();

View File

@ -18,13 +18,15 @@ public class MyButton : Efl.Ui.Button
base(parent)
{
button_id = id;
base.SetText("Base text for button id " + id);
base.Text = "Base text for button id " + id;
}
// This calls the parent's SetText() method with a modified string
public override void SetText(System.String text)
public override string Text
{
base.SetText("Overriden text for button id " + button_id + ": " + text);
set {
base.Text = "Overriden text for button id " + button_id + ": " + value;
}
}
}
@ -34,22 +36,22 @@ public class Example : Efl.Csharp.Application
{
// Create a window and initialize it
Efl.Ui.Win win = new Efl.Ui.Win(null, winType: Efl.Ui.WinType.Basic);
win.SetText("Custom widget demo");
win.SetAutohide(true);
win.Text = "Custom widget demo";
win.Autohide = true;
win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
// Exit the EFL main loop when the window is closed
if (e.Arg == false)
Efl.Ui.Config.Exit();
};
// Give the window an initial size
win.SetSize(new Eina.Size2D(350,250));
win.Size = new Eina.Size2D(350,250);
// Instantiate our custom button widget
MyButton btn = new MyButton(win, 99);
btn.ClickedEvent += (object sender, Efl.Input.ClickableClickedEventArgs e) => {
// When the button is clicked, change its text
MyButton b = (MyButton)sender;
b.SetText("Hello!");
b.Text = "Hello!";
};
win.SetContent(btn);

View File

@ -14,8 +14,8 @@ public class Example : Efl.Csharp.Application
{
// Create a window and initialize it
Efl.Ui.Win win = new Efl.Ui.Win(null, winType: Efl.Ui.WinType.Basic);
win.SetText("Size Control");
win.SetAutohide(true);
win.Text = "Size Control";
win.Autohide = true;
win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
// Exit the EFL main loop
if (e.Arg == false)
@ -28,19 +28,19 @@ public class Example : Efl.Csharp.Application
// Create a regular button (without size hints)
var button = new Efl.Ui.Button(win);
button.SetText("Button");
button.Text = "Button";
box.Pack(button);
// Create a small button (max size is limited)
button = new Efl.Ui.Button(win);
button.SetText("Small");
button.SetHintSizeMax(new Eina.Size2D(50,50));
button.Text = "Small";
button.HintSizeMax = new Eina.Size2D(50,50);
box.Pack(button);
// Create a big button (min size is limited)
button = new Efl.Ui.Button(win);
button.SetText("Big button");
button.SetHintSizeMin(new Eina.Size2D(100,100));
button.Text = "Big button";
button.HintSizeMin = new Eina.Size2D(100,100);
box.Pack(button);
}

View File

@ -9,15 +9,15 @@ public class Example : Efl.Csharp.Application
{
// First create a root element
root = new Efl.GenericModel(null);
root.SetName("Root");
root.Name = "Root";
// Create the first child element
var child = new Efl.GenericModel(root);
child.SetName("Child1");
child.Name = "Child1";
// Create the second child element, this time, with an extra reference
child2 = new Efl.GenericModel(root);
child2.SetName("Child2");
child2.Name = "Child2";
}
// Destroy the test hierarchy

View File

@ -15,17 +15,17 @@ public class Example : Efl.Csharp.Application
// Create a window and initialize it
Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
// Set the window's title
win.SetText("Hello World");
win.Text = "Hello World";
// Request that the window is automatically hidden when the "close"
// button is pressed
win.SetAutohide(true);
win.Autohide = true;
// Hook to the Hide event
win.VisibilityChangedEvent += QuitCb;
// Create a box container
var box = new Efl.Ui.Box(win);
// Set its minimum size
box.SetHintSizeMin(new Eina.Size2D(360, 240));
box.HintSizeMin = new Eina.Size2D(360, 240);
// Set the box as the content for the window
// The window size will adapt to the box size
win.SetContent(box);
@ -33,20 +33,20 @@ public class Example : Efl.Csharp.Application
// Create a text label widget
var label = new Efl.Ui.Textbox(box);
// Set its content and customize it
label.SetText("Hello World. This is an Efl.Ui application!");
label.Text = "Hello World. This is an Efl.Ui application!";
label.Editable = false;
label.SelectionAllowed = false;
label.SetHintWeight(1.0, 0.9);
label.SetHintFill(false, false);
label.SetHintAlign(0.5, 0.5);
label.HintWeight = (1.0, 0.9);
label.HintFill = (false, false);
label.HintAlign = ((Efl.Gfx.Align)0.5, (Efl.Gfx.Align)0.5);
// Add the text to the box container
box.Pack(label);
// Create a button widget
var button = new Efl.Ui.Button(box);
// Customize it
button.SetText("Quit");
button.SetHintWeight(1.0, 0.1);
button.Text = "Quit";
button.HintWeight = (1.0, 0.1);
// Set the method to be called when the button is pressed
button.ClickedEvent += (object sender, Efl.Input.ClickableClickedEventArgs e) => { Efl.App.AppMain.Quit(0); };
// Add the button to the box container

View File

@ -15,13 +15,13 @@ public class Example : Efl.Csharp.Application
// Create a window and initialize it
Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
// Set the window's title
win.SetText("Hello World");
win.Text = "Hello World";
// Request that the window is automatically hidden when the "close"
// button is pressed
win.SetAutohide(true);
win.Autohide = true;
// Window size must be explicitly set, otherwise it will be invisible
// due to its lack of content.
win.SetSize(new Eina.Size2D(360, 240));
win.Size = new Eina.Size2D(360, 240);
win.VisibilityChangedEvent += QuitCb;
}

View File

@ -7,8 +7,8 @@ public class Example
int w, int h,
EventHandler callback) {
Efl.Ui.Button button = new Efl.Ui.Button(parent);
button.SetText(text);
button.SetSize(new Eina.Size2D(w, h));
button.Text = text;
button.Size = new Eina.Size2D(w, h);
button.ClickedEvent += callback;
@ -37,8 +37,8 @@ public class Example
Efl.All.Init(Efl.Components.Ui);
Efl.Ui.Win win = new Efl.Ui.Win(null);
win.SetText("Hello, C#!!");
win.SetAutohide(true);
win.Text = "Hello, C#!!";
win.Autohide = true;
Efl.Ui.Box_Flow box = new Efl.Ui.Box_Flow(win);
@ -50,11 +50,11 @@ public class Example
box.DoPack(button);
Efl.Ui.Progressbar bar = new Efl.Ui.Progressbar(box);
bar.SetSize(new Eina.Size2D(W, H));
bar.Size = new Eina.Size2D(W, H);
bar.SetFormatCb(Formatter);
Efl.Ui.Slider slider = new Efl.Ui.Slider(box);
slider.SetSize(new Eina.Size2D(W, H));
slider.Size = new Eina.Size2D(W, H);
slider.ChangedEvent += (object sender, EventArgs e) => {
bar.SetRangeValue(slider.GetRangeValue());
@ -66,7 +66,7 @@ public class Example
button.SetVisible(true);
box.SetVisible(true);
win.SetSize(new Eina.Size2D(W, 3 * H));
win.Size = new Eina.Size2D(W, 3 * H);
win.SetVisible(true);
Efl.Ui.Config.Run();

View File

@ -18,11 +18,11 @@ public class Example
{
Efl.Ui.Popup_Alert popup = new Efl.Ui.Popup_Alert(win);
Efl.Ui.Text popup_text = new Efl.Ui.Text(popup);
popup_text.SetText($"Error: {message}");
popup_text.Text = $"Error: {message}";
popup.SetContent(popup_text);
popup.SetVisible(true);
popup.SetButton(Efl.Ui.Popup_Alert_Button.Positive, "Ok");
popup.SetSize(new Eina.Size2D(150, 30));
popup.Size = new Eina.Size2D(150, 30);
popup.ButtonClickedEvent += (object sender, Efl.Ui.Popup_Alert.ButtonClickedEventArgs e) => {
popup.Del()
};
@ -41,31 +41,31 @@ public class Example
Efl.All.Init(Efl.Components.Ui);
Efl.Ui.Win win = new Efl.Ui.Win(null);
win.SetText("C# Unit Converter");
win.SetAutohide(true);
win.Text = "C# Unit Converter";
win.Autohide = true;
Efl.Ui.Box_Flow box = new Efl.Ui.Box_Flow(win);
box.SetOrientation(Efl.Ui.LayoutOrientation.Horizontal);
box.Orientation = Efl.Ui.LayoutOrientation.Horizontal;
Efl.Ui.Box_Flow miles_box = new Efl.Ui.Box_Flow(box);
miles_box.SetOrientation(Efl.Ui.LayoutOrientation.Down);
miles_box.Orientation = Efl.Ui.LayoutOrientation.Down;
box.DoPack(miles_box);
Efl.Ui.Text miles_label = new Efl.Ui.Text(miles_box);
miles_label.SetText("Miles:");
miles_label.SetSize(size);
miles_label.Text = "Miles:";
miles_label.Size = size;
miles_label.SetVisible(true);
Efl.Ui.Text_Editable miles_input = new Efl.Ui.Text_Editable(miles_box);
miles_input.SetText("");
miles_input.Text = "";
miles_input.SetScrollable(true);
miles_input.SetSize(size);
miles_input.Size = size;
miles_input.SetVisible(true);
Efl.Ui.Button miles_button = new Efl.Ui.Button(miles_box);
miles_button.SetText("To Km");
miles_button.SetSize(size);
miles_button.Text = "To Km";
miles_button.Size = size;
miles_button.SetVisible(true);
miles_box.DoPack(miles_label);
@ -74,24 +74,24 @@ public class Example
Efl.Ui.Box_Flow kms_box = new Efl.Ui.Box_Flow(box);
kms_box.SetOrientation(Efl.Ui.LayoutOrientation.Down);
kms_box.Orientation = Efl.Ui.LayoutOrientation.Down;
box.DoPack(kms_box);
Efl.Ui.Text kms_label = new Efl.Ui.Text(kms_box);
kms_label.SetText("Kilometers:");
kms_label.SetSize(size);
kms_label.Text = "Kilometers:";
kms_label.Size = size;
kms_label.SetVisible(true);
Efl.Ui.Text_Editable kms_input = new Efl.Ui.Text_Editable(kms_box);
kms_input.SetText("");
kms_input.Text = "";
kms_input.SetScrollable(true);
kms_input.SetSize(size);
kms_input.Size = size;
kms_input.SetVisible(true);
Efl.Ui.Button kms_button = new Efl.Ui.Button(kms_box);
kms_button.SetText("To Miles");
kms_button.SetSize(size);
kms_button.Text = "To Miles";
kms_button.Size = size;
kms_button.SetVisible(true);
kms_box.DoPack(kms_label);
@ -101,10 +101,10 @@ public class Example
kms_button.ClickedEvent += (object sender, EventArgs e) => {
try
{
string text = kms_input.GetText();
string text = kms_input.Text;
Console.WriteLine("Text is [{0}]", text);
double val = double.Parse(text);
miles_input.SetText(String.Format("{0:f3}", KmsToMiles(val)));
miles_input.Text = String.Format("{0:f3}", KmsToMiles(val));
kms_input.SetFocus(true);
}
catch (FormatException ex)
@ -117,10 +117,10 @@ public class Example
miles_button.ClickedEvent += (object sender, EventArgs e) => {
try
{
string text = miles_input.GetText();
string text = miles_input.Text;
Console.WriteLine("Text is [{0}]", text);
double val = double.Parse(text);
kms_input.SetText(String.Format("{0:f3}", MilesToKms(val)));
kms_input.Text = String.Format("{0:f3}", MilesToKms(val));
miles_input.SetFocus(true);
}
catch (FormatException ex)
@ -138,7 +138,7 @@ public class Example
win.SetPosition(new Eina.Position2D(200, 200));
win.SetSize(new Eina.Size2D(400, 120));
win.Size = new Eina.Size2D(400, 120);
win.SetVisible(true);
Efl.Ui.Config.Run();

View File

@ -49,20 +49,20 @@ class TestMain
size.W = 320;
size.H = 240;
box.SetSize(size);
box.Size = size;
box.SetVisible(true);
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
rect.SetColor(0, 0, 255, 255);
rect.Color = (0, 0, 255, 255);
size.W = 320;
size.H = 120;
rect.SetSize(size);
rect.Size = size;
rect.SetVisible(true);
box.Append(rect);
Efl.Canvas.Rectangle rect2 = new Efl.Canvas.Rectangle(canvas);
rect2.SetColor(0, 255, 0, 255);
rect2.SetSize(size);
rect2.Color = (0, 255, 0, 255);
rect2.Size = size;
rect2.SetVisible(true);
box.Append(rect2);

View File

@ -35,10 +35,10 @@ class TestMain
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
bg.SetColor(255, 255, 255, 255);
bg.Color = (255, 255, 255, 255);
size.W = WIDTH;
size.H = HEIGHT;
bg.SetSize(size);
bg.Size = size;
bg.SetVisible(true);
string valid_path = args[0];
@ -60,7 +60,7 @@ class TestMain
size.W = WIDTH / 2;
size.H = HEIGHT / 2;
image.SetSize(size);
image.Size = size;
image.SetVisible(true);
rect = image.GetFill();

View File

@ -23,13 +23,13 @@ class TestMain
canvas.SetVisible(true);
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
bg.SetColor(255, 255, 255, 255);
bg.Color = (255, 255, 255, 255);
pos.X = 0;
pos.Y = 0;
bg.SetPosition(pos);
size.W = WIDTH;
size.H = HEIGHT;
bg.SetSize(size);
bg.Size = size;
bg.SetVisible(true);
string path = args[0];
@ -41,7 +41,7 @@ class TestMain
logo.SetFile(path, null);
size.W = WIDTH / 2;
size.H = HEIGHT / 2;
logo.SetSize(size);
logo.Size = size;
// TODO add a bunch of key/mouse handlers
@ -56,7 +56,7 @@ class TestMain
evas.Image noise_img = new evas.Image(canvas);
size.W = WIDTH / 4;
size.H = HEIGHT / 4;
noise_img.SetSize(size);
noise_img.Size = size;
// FIXME Add a way to set the pixels.
// noise_img.data_set(pixels);
noise_img.SetFillAuto(true);
@ -73,7 +73,7 @@ class TestMain
proxy_img.SetPosition(pos);
size.W = WIDTH / 2;
size.H = HEIGHT / 2;
proxy_img.SetSize(size);
proxy_img.Size = size;
proxy_img.SetVisible(true);
loop.Begin();

View File

@ -23,11 +23,11 @@ class TestMain
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255);
rect.Color = (colors[0, 0], colors[0, 1], colors[0, 2], 255);
Eina.Size2D size = new Eina.Size2D();
size.W = 640;
size.H = 480;
rect.SetSize(size);
rect.Size = size;
rect.SetVisible(true);
canvas.KeyDownEvent += (object sender, Efl.Input.Interface.KeyDownEventArgs e) => {

View File

@ -28,19 +28,19 @@ class TestMain
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
bg.SetColor(255, 255, 255, 255);
bg.SetSize(size);
bg.Color = (255, 255, 255, 255);
bg.Size = size;
bg.SetVisible(true);
evas.Table table = new evas.Table(canvas);
table.SetHomogeneous(evas.object_table.Homogeneous_Mode.None);
table.SetPadding(0, 0);
table.SetSize(size);
table.Size = size;
table.SetVisible(true);
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
rect.SetColor(255, 0, 0, 255);
rect.Color = (255, 0, 0, 255);
hint.W = 100;
hint.H = 50;
rect.SetHintMin(hint);
@ -48,7 +48,7 @@ class TestMain
table.Pack(rect, 1, 1, 2, 1);
rect = new Efl.Canvas.Rectangle(canvas);
rect.SetColor(0, 255, 0, 255);
rect.Color = (0, 255, 0, 255);
hint.W = 50;
hint.H = 100;
rect.SetHintMin(hint);
@ -56,7 +56,7 @@ class TestMain
table.Pack(rect, 1, 2, 1, 2);
rect = new Efl.Canvas.Rectangle(canvas);
rect.SetColor(0, 0, 255, 255);
rect.Color = (0, 0, 255, 255);
hint.W = 50;
hint.H = 50;
rect.SetHintMin(hint);
@ -64,7 +64,7 @@ class TestMain
table.Pack(rect, 2, 2, 1, 1);
rect = new Efl.Canvas.Rectangle(canvas);
rect.SetColor(255, 255, 0, 255);
rect.Color = (255, 255, 0, 255);
rect.SetHintMin(hint);
rect.SetVisible(true);
table.Pack(rect, 2, 3, 1, 1);

View File

@ -35,13 +35,13 @@ class TestMain
canvas.SetVisible(true);
bg = new Efl.Canvas.Rectangle(canvas);
bg.SetColor(255, 255, 255, 255);
bg.Color = (255, 255, 255, 255);
position.X = 0;
position.Y = 0;
bg.SetPosition(position);
size.W = WIDTH;
size.H = HEIGHT;
bg.SetSize(size);
bg.Size = size;
bg.SetVisible(true);
bg.SetKeyFocus(true);
@ -50,16 +50,16 @@ class TestMain
text = new evas.Text(canvas);
text.SetStyle(evas.Text_Style_Type.OutlineSoftShadow);
text.SetColor(0, 0, 0, 255);
text.Color = (0, 0, 0, 255);
text.SetGlowColor(255, 0, 0, 255);
text.SetOutlineColor(0, 0, 255, 255);
text.SetShadowColor(0, 255,255, 255);
text.SetFont("Courier", 30);
text.SetText("sample text");
text.Text = "sample text";
size.W = 3*WIDTH / 4;
size.H = HEIGHT / 4;
text.SetSize(size);
text.Size = size;
position.X = WIDTH / 8;
position.Y = 3 * HEIGHT / 8;
text.SetPosition(position);
@ -78,7 +78,7 @@ class TestMain
size.W = 3 * WIDTH / 4 + 3;
size.H = HEIGHT / 4 + 3;
border.SetSize(size);
border.Size = size;
position.X = WIDTH / 8 - 3;
position.Y = 3 * HEIGHT / 8 - 3;
border.SetPosition(position);