csharp examples: Adapt to new classes syntax

Summary: Mainly use PascalCase Namespaces and Classes and proper event names.

Test Plan: Check all examples still build.

Reviewers: lauromoura, vitor.sousa, felipealmeida, bu5hm4n

Reviewed By: bu5hm4n

Differential Revision: https://phab.enlightenment.org/D7479
devs/bu5hm4n/syntax-update
Xavi Artigas 4 years ago
parent 656b746be7
commit d74a4df994
  1. 8
      apps/csharp/life/src/life_board.cs
  2. 32
      apps/csharp/life/src/life_main.cs
  3. 24
      apps/csharp/life/src/life_render.cs
  4. 52
      apps/csharp/texteditor/src/texteditor_main.cs
  5. 14
      reference/csharp/core/src/core_event.cs
  6. 10
      reference/csharp/core/src/core_idler.cs
  7. 10
      reference/csharp/core/src/core_poll.cs
  8. 12
      reference/csharp/eina/src/eina_array.cs
  9. 16
      reference/csharp/eina/src/eina_hash.cs
  10. 22
      reference/csharp/eina/src/eina_iterator.cs
  11. 10
      reference/csharp/eina/src/eina_list.cs
  12. 14
      reference/csharp/eina/src/eina_log.cs
  13. 14
      reference/csharp/eina/src/eina_value.cs
  14. 34
      reference/csharp/ui/src/focus_main.cs
  15. 52
      reference/csharp/ui/src/ui_container.cs
  16. 24
      reference/csharp/ui/src/ui_sizing.cs
  17. 12
      tutorial/csharp/eo-intro/src/eo_intro_main.cs
  18. 18
      tutorial/csharp/hello-gui/src/gui_main.cs
  19. 10
      tutorial/csharp/hello-world/src/hello-world.cs
  20. 10
      unsorted/ecore/efl_loop_callback_add_event.cs
  21. 12
      unsorted/ecore/efl_loop_timer_example.cs
  22. 6
      unsorted/efl_mono/EoInherit01.cs
  23. 4
      unsorted/efl_mono/FunctionPointer01.cs
  24. 4
      unsorted/eina/EinaArray01.cs
  25. 4
      unsorted/eina/EinaBinbuf01.cs
  26. 34
      unsorted/eina/EinaError01.cs
  27. 4
      unsorted/eina/EinaHash01.cs
  28. 32
      unsorted/elementary/efl_ui_slider_mono.cs
  29. 52
      unsorted/elementary/efl_ui_unit_converter.cs
  30. 18
      unsorted/evas/evas_mono_box.cs
  31. 20
      unsorted/evas/evas_mono_image.cs
  32. 14
      unsorted/evas/evas_mono_image2.cs
  33. 16
      unsorted/evas/evas_mono_rectangle.cs
  34. 24
      unsorted/evas/evas_mono_table.cs
  35. 20
      unsorted/evas/evas_mono_text.cs

@ -19,7 +19,7 @@ public class LifeBoard
private bool[] board;
private bool[] board1, board2;
private efl.ILoop_Timer lifeTimer = null;
private Efl.LoopTimer lifeTimer = null;
private LifeRender lifeRender = null;
private void CellOn(int x, int y)
@ -58,9 +58,9 @@ public class LifeBoard
board = board1;
}
public void Run(efl.ui.IWin win)
public void Run(Efl.Ui.Win win)
{
lifeTimer = new efl.Loop_Timer(win, (efl.ILoop_Timer etimer) => {
lifeTimer = new Efl.LoopTimer(win, (Efl.LoopTimer etimer) => {
etimer.SetInterval(0.1);
});
@ -141,7 +141,7 @@ public class LifeBoard
board = work;
}
public void TogglePause(efl.ui.IWin win)
public void TogglePause(Efl.Ui.Win win)
{
if (lifeTimer != null)
{

@ -7,19 +7,19 @@ public class LifeWindow
void ResizeEvt(object sender, EventArgs ev)
{
lifeRender.RenderLayout((efl.ui.IWin)sender);
lifeRender.RenderLayout((Efl.Ui.Win)sender);
}
void QuitEvt(object sender, EventArgs ev)
{
// quit the mainloop
efl.ui.Config.Exit();
Efl.Ui.Config.Exit();
}
void TouchEvt(object sender, efl.input.Interface.PointerDownEvt_Args ev)
void TouchEvt(object sender, Efl.Input.InterfacePointerDownEvt_Args ev)
{
int cellx, celly;
efl.ui.IWin win = (efl.ui.IWin)sender;
Efl.Ui.Win win = (Efl.Ui.Win)sender;
var position = ev.arg.GetPosition();
lifeRender.CellForCoords(win, position, out cellx, out celly);
@ -28,25 +28,25 @@ public class LifeWindow
lifeRender.RenderCell(win, cellx, celly);
}
void KeyDownEvt(object sender, efl.input.Interface.KeyDownEvt_Args ev)
void KeyDownEvt(object sender, Efl.Input.InterfaceKeyDownEvt_Args ev)
{
efl.ui.IWin win = (efl.ui.IWin)sender;
Efl.Ui.Win win = (Efl.Ui.Win)sender;
if (ev.arg.GetKey() == "space")
lifeBoard.TogglePause(win);
}
public LifeWindow()
{
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
ewin.SetWinType(efl.ui.Win_Type.Basic);
Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
ewin.SetWinType(Efl.Ui.WinType.Basic);
ewin.SetText("EFL Life");
ewin.SetAutohide(true);
});
// when the user clicks "close" on a window there is a request to hide
win.HideEvt += QuitEvt;
((Efl.Gfx.Entity)win).HideEvt += QuitEvt;
eina.Size2D sz;
Eina.Size2D sz;
sz.W = (int)(10 * LifeBoard.Width * win.GetScale());
sz.H = (int)(10 * LifeBoard.Height * win.GetScale());
@ -54,9 +54,9 @@ public class LifeWindow
lifeRender = new LifeRender(win, lifeBoard);
lifeRender.Refresh(win);
win.ResizeEvt += ResizeEvt;
win.PointerDownEvt += TouchEvt;
win.KeyDownEvt += KeyDownEvt;
((Efl.Gfx.Entity)win).ResizeEvt += ResizeEvt;
((Efl.Input.Interface)win).PointerDownEvt += TouchEvt;
((Efl.Input.Interface)win).KeyDownEvt += KeyDownEvt;
win.SetSize(sz);
@ -68,13 +68,13 @@ public class Example
{
public static void Main()
{
efl.All.Init(efl.Components.Ui);
Efl.All.Init(Efl.Components.Ui);
var lifeWin = new LifeWindow();
// start the mainloop
efl.ui.Config.Run();
Efl.Ui.Config.Run();
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -2,34 +2,34 @@ using System;
public class LifeRender
{
private efl.canvas.IRectangle[] lifeCells;
private Efl.Canvas.Rectangle[] lifeCells;
private LifeBoard lifeBoard;
public LifeRender(efl.ui.IWin win, LifeBoard board)
public LifeRender(Efl.Ui.Win win, LifeBoard board)
{
lifeBoard = board;
lifeBoard.SetRender(this);
lifeCells = new efl.canvas.Rectangle[LifeBoard.Height * LifeBoard.Width];
lifeCells = new Efl.Canvas.Rectangle[LifeBoard.Height * LifeBoard.Width];
for (int y = 0; y < LifeBoard.Height; ++y)
for (int x = 0; x < LifeBoard.Width; ++x)
lifeCells[LifeBoard.IndexForPosition(x, y)] = new efl.canvas.Rectangle(win);
lifeCells[LifeBoard.IndexForPosition(x, y)] = new Efl.Canvas.Rectangle(win);
RenderLayout(win);
}
public void CellForCoords(efl.ui.IWin win, eina.Position2D coord, out int x, out int y)
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.GetSize();
x = coord.X * LifeBoard.Width / size.W;
y = coord.Y * LifeBoard.Height / size.H;
}
public void RenderLayout(efl.ui.IWin win)
public void RenderLayout(Efl.Ui.Win win)
{
eina.Size2D size = win.GetSize();
Eina.Size2D size = win.GetSize();
double cw = (double) size.W / LifeBoard.Width;
double ch = (double) size.H / LifeBoard.Height;
@ -39,19 +39,19 @@ public class LifeRender
var rect = lifeCells[LifeBoard.IndexForPosition(x, y)];
// the little +1 here will avoid tearing as we layout non-multiple sizes
eina.Size2D sz;
Eina.Size2D sz;
sz.W = (int)(cw + 1);
sz.H = (int)(ch + 1);
rect.SetSize(sz);
eina.Position2D pos;
Eina.Position2D pos;
pos.X = (int)(x * cw);
pos.Y = (int)(y * ch);
rect.SetPosition(pos);
}
}
public void RenderCell(efl.ui.IWin win, int x, int y)
public void RenderCell(Efl.Ui.Win win, int x, int y)
{
int i = LifeBoard.IndexForPosition(x, y);
var rect = lifeCells[i];
@ -62,7 +62,7 @@ public class LifeRender
rect.SetColor(255, 255, 255, 255);
}
public void Refresh(efl.ui.IWin win)
public void Refresh(Efl.Ui.Win win)
{
for (int y = 0; y < LifeBoard.Height; ++y)
for (int x = 0; x < LifeBoard.Width; ++x)

@ -19,11 +19,11 @@ using System;
public class TextEditor
{
private efl.ui.IWin win; // The main window
private efl.ui.IText editorTextBox; // The main text entry
private efl.ui.IButton toolbarButtonNew; // The "New" button in the toolbar
private efl.ui.IButton toolbarButtonSave; // The "Save" button in the toolbar
private efl.ui.IButton toolbarButtonLoad; // The "Load" button in the toolbar
private Efl.Ui.Win win; // The main window
private Efl.Ui.Text editorTextBox; // The main text entry
private Efl.Ui.Button toolbarButtonNew; // The "New" button in the toolbar
private Efl.Ui.Button toolbarButtonSave; // The "Save" button in the toolbar
private Efl.Ui.Button toolbarButtonLoad; // The "Load" button in the toolbar
private bool edited = false; // Document was edited since last save
@ -34,7 +34,7 @@ public class TextEditor
// Quits the application
private void GUIQuitCb(object sender, EventArgs ea)
{
efl.ui.Config.Exit();
Efl.Ui.Config.Exit();
}
// Enables or disables buttons on the toolbar as required
@ -58,32 +58,32 @@ public class TextEditor
// Shows a modal message popup with an "OK" button
private void ShowMessage(string message)
{
new efl.ui.Text_Alert_Popup (win, (efl.ui.IText_Alert_Popup epopup) => {
new Efl.Ui.TextAlertPopup (win, (Efl.Ui.TextAlertPopup epopup) => {
epopup.SetText(message);
epopup.SetExpandable(new eina.Size2D(200,200));
epopup.SetButton(efl.ui.Alert_Popup_Button.Positive, "OK", null);
epopup.SetExpandable(new Eina.Size2D(200,200));
epopup.SetButton(Efl.Ui.AlertPopupButton.Positive, "OK", null);
epopup.ButtonClickedEvt +=
(object sender, efl.ui.Alert_Popup.ButtonClickedEvt_Args ea) => {
(object sender, Efl.Ui.AlertPopupButtonClickedEvt_Args ea) => {
// Dismiss popup when the button is clicked
((efl.ui.IText_Alert_Popup)sender).SetParent(null);
((Efl.Ui.TextAlertPopup)sender).SetParent(null);
};
});
}
// Adds a button to the toolbar, with the given text, icon and click event handler
private efl.ui.IButton GUIToolbarButtonAdd(efl.ui.IBox toolbar, string name,
private Efl.Ui.Button GUIToolbarButtonAdd(Efl.Ui.Box toolbar, string name,
string iconName, EventHandler func)
{
return new efl.ui.Button(toolbar, (efl.ui.IButton ebutton) => {
return new Efl.Ui.Button(toolbar, (Efl.Ui.Button ebutton) => {
ebutton.SetText(name);
ebutton.ClickedEvt += func;
ebutton.SetHintWeight(0, 1);
toolbar.DoPack(ebutton);
// Set the content of the button
efl.Content.static_cast(ebutton.GetPart("efl.content")).SetContent(
ebutton.SetContent(
// Which is an image
new efl.ui.Image(toolbar, (efl.ui.IImage eimage) => {
new Efl.Ui.Image(toolbar, (Efl.Ui.Image eimage) => {
eimage.SetIcon(iconName);
})
);
@ -91,15 +91,15 @@ public class TextEditor
}
// Creates a new toolbar, with all its buttons
private void GUIToolbarSetup(efl.ui.IBox parent)
private void GUIToolbarSetup(Efl.Ui.Box parent)
{
// Create a horizontal box container for the buttons
efl.ui.IBox bar = new efl.ui.Box(parent, (efl.ui.IBox ebox) => {
Efl.Ui.Box bar = new Efl.Ui.Box(parent, (Efl.Ui.Box ebox) => {
// 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.
ebox.SetHintWeight(1, 0);
ebox.SetDirection(efl.ui.Dir.Horizontal);
ebox.SetDirection(Efl.Ui.Dir.Horizontal);
parent.DoPack(ebox);
});
@ -146,7 +146,7 @@ public class TextEditor
// a horizontal weight of 0).
// As a result, it pushes the "Quit" button to the right margin and
// the rest to the left.
efl.ui.IBox box = new efl.ui.Box(parent);
Efl.Ui.Box box = new Efl.Ui.Box(parent);
bar.DoPack(box);
// "Quit" button
@ -157,26 +157,26 @@ public class TextEditor
public TextEditor()
{
// Create a window and initialize it
win = new efl.ui.Win(efl.App.GetLoopMain(), (efl.ui.IWin ewin) => {
win = new Efl.Ui.Win(Efl.App.GetLoopMain(), (Efl.Ui.Win ewin) => {
ewin.SetText("Text Editor");
ewin.SetAutohide(true);
ewin.HideEvt += GUIQuitCb;
});
// Create a vertical box container
efl.ui.IBox box = new efl.ui.Box(win);
Efl.Ui.Box box = new Efl.Ui.Box(win);
win.SetContent(box);
// Create the toolbar and add it to the box
GUIToolbarSetup(box);
// Create the main text entry
editorTextBox = new efl.ui.Text(box, (efl.ui.IText etext) => {
editorTextBox = new Efl.Ui.Text(box, (Efl.Ui.Text etext) => {
etext.SetFont("Mono", 14);
etext.SetMultiline(true);
etext.SetEditable(true);
etext.SetScrollable(true);
etext.SetHintMin(new eina.Size2D(360, 240));
etext.SetHintMin(new Eina.Size2D(360, 240));
etext.ChangedEvt += EditorChangedCb;
etext.ChangedUserEvt += EditorChangedCb;
box.DoPack(etext);
@ -190,7 +190,7 @@ public class TextEditor
public void Run()
{
// Start the EFL main loop
efl.ui.Config.Run();
Efl.Ui.Config.Run();
}
}
@ -202,13 +202,13 @@ public class Example
public static void Main()
{
// Initialize EFL and all UI components
efl.All.Init(efl.Components.Ui);
Efl.All.Init(Efl.Components.Ui);
var textEditor = new TextEditor();
textEditor.Run();
// Shutdown EFL
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -12,7 +12,7 @@ public class Example
// Polling callback
private static void PollCb(object sender, EventArgs e)
{
Console.WriteLine(" Poll from {0}", ((efl.IObject)sender).GetName());
Console.WriteLine(" Poll from {0}", ((Efl.Object)sender).GetName());
}
#if WIN32
@ -21,17 +21,17 @@ public class Example
public static void Main()
{
// Initialize EFL and all UI components
efl.All.Init();
Efl.All.Init();
// Retrieve the application's main loop
var mainloop = efl.App.GetLoopMain();
var mainloop = Efl.App.GetLoopMain();
mainloop.SetName("Mainloop");
// This event gets triggered continuously
mainloop.PollHighEvt += PollCb;
// This timer will control events fired by the main loop
new efl.Loop_Timer(mainloop, (efl.ILoop_Timer etimer) => {
new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
etimer.SetName("Timer");
// Trigger every 100ms
etimer.SetInterval(0.1);
@ -51,10 +51,10 @@ public class Example
break;
default:
message += "Quitting";
mainloop.Quit(new eina.Value(0));
mainloop.Quit(new Eina.Value(0));
break;
}
Console.WriteLine(message, tick_count, ((efl.IObject)sender).GetName());
Console.WriteLine(message, tick_count, ((Efl.Object)sender).GetName());
tick_count++;
};
});
@ -65,7 +65,7 @@ public class Example
mainloop.Begin();
// Shutdown EFL
efl.All.Shutdown();
Efl.All.Shutdown();
Console.WriteLine("Application is over");
}

@ -17,10 +17,10 @@ public class Example
public static void Main()
{
// Initialize EFL and all UI components
efl.All.Init();
Efl.All.Init();
// Retrieve the application's main loop
var mainloop = efl.App.GetLoopMain();
var mainloop = Efl.App.GetLoopMain();
// Register to all Idle events
mainloop.IdleEnterEvt += (object sender, EventArgs e) => {
@ -34,12 +34,12 @@ public class Example
};
// Use a timer to exit the application
new efl.Loop_Timer(mainloop, (efl.ILoop_Timer etimer) => {
new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
// Trigger after 10ms
etimer.SetInterval(0.01);
etimer.TickEvt += (object sender, EventArgs e) => {
Console.WriteLine("TIMER: timer callback called, exiting.");
mainloop.Quit(new eina.Value(0));
mainloop.Quit(new Eina.Value(0));
};
});
@ -47,6 +47,6 @@ public class Example
mainloop.Begin();
// Shutdown EFL
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -16,10 +16,10 @@ public class Example
public static void Main()
{
// Initialize EFL and all UI components
efl.All.Init();
Efl.All.Init();
// Retrieve the application's main loop
var mainloop = efl.App.GetLoopMain();
var mainloop = Efl.App.GetLoopMain();
// Register to all Poll events
mainloop.PollLowEvt += (object sender, EventArgs e) => {
@ -33,12 +33,12 @@ public class Example
};
// Use a timer to exit the application
new efl.Loop_Timer(mainloop, (efl.ILoop_Timer etimer) => {
new Efl.LoopTimer(mainloop, (Efl.LoopTimer etimer) => {
// Trigger after 30s
etimer.SetInterval(30);
etimer.TickEvt += (object sender, EventArgs e) => {
Console.WriteLine("\nTIMER: timer callback called, exiting.");
mainloop.Quit(new eina.Value(0));
mainloop.Quit(new Eina.Value(0));
};
});
@ -46,6 +46,6 @@ public class Example
mainloop.Begin();
// Shutdown EFL
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -1,8 +1,8 @@
/*
* Eina Array examples.
*
* These examples demonstrate how to work with eina_array data and methods.
* We use a simple array of strings to initialise our eina_array before
* These examples demonstrate how to work with Eina_array data and methods.
* We use a simple array of strings to initialise our Eina_array before
* performing various mutations and printing the results.
*/
@ -10,7 +10,7 @@ using System;
public class Example
{
static eina.Array<string> CreateArray()
static Eina.Array<string> CreateArray()
{
// some content to populate our array
string[] names =
@ -22,7 +22,7 @@ public class Example
};
// set up an array with a growth step to give a little headroom
var array = new eina.Array<string>(25u);
var array = new Eina.Array<string>(25u);
foreach (string name in names)
array.Push(name);
@ -40,7 +40,7 @@ public class Example
public static void Main()
{
efl.All.Init();
Efl.All.Init();
var array = CreateArray();
@ -69,7 +69,7 @@ public class Example
array.Dispose();
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -1,7 +1,7 @@
/*
* Eina Hash examples.
*
* These examples demonstrate how to work with eina_hash data and methods.
* These examples demonstrate how to work with Eina_hash data and methods.
*
* We have two main hash objects here, firstly an int keyed hash with some
* dummy content.
@ -14,10 +14,10 @@ using System.Collections.Generic;
public class Example
{
static eina.Hash<Int32, string> CreateHash()
static Eina.Hash<Int32, string> CreateHash()
{
// let's create a simple hash with integers as keys
var hash = new eina.Hash<Int32, string>();
var hash = new Eina.Hash<Int32, string>();
// Add initial entries to our hash
for (int i = 0; i < 10; ++i)
@ -53,7 +53,7 @@ public class Example
Console.WriteLine($" Name: {key}\tNumber {data}\n");
}
static void PrintPhonebook(eina.Hash<string, string> book)
static void PrintPhonebook(Eina.Hash<string, string> book)
{
int count = book.Population();
Console.WriteLine($"Complete phone book ({count}):");
@ -65,7 +65,7 @@ public class Example
Console.WriteLine("");
}
static eina.Hash<string, string> CreatePhonebook()
static Eina.Hash<string, string> CreatePhonebook()
{
string[] names =
{
@ -79,7 +79,7 @@ public class Example
};
// create hash of strings to strings
var hash = new eina.Hash<string, string>();
var hash = new Eina.Hash<string, string>();
// Add initial entries to our hash
for (int i = 0; i < 4; ++i)
@ -119,11 +119,11 @@ public class Example
public static void Main()
{
efl.All.Init();
Efl.All.Init();
HashDemo();
PhonebookDemo();
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -2,8 +2,8 @@
/*
* Eina Iterator examples.
*
* These examples demonstrate how to work with eina_iterator methods.
* Both an eina_list and an eina_array are created and an iterator obtained
* These examples demonstrate how to work with Eina_iterator methods.
* Both an Eina_list and an Eina_array are created and an iterator obtained
* for both. You can see how we can use iterators irrespective of the source
* and also that there are different ways to work with iterating content.
*/
@ -12,7 +12,7 @@ using System;
public class Example
{
static void PrintIterator(eina.Iterator<string> it)
static void PrintIterator(Eina.Iterator<string> it)
{
Console.WriteLine("--iterator start--");
foreach(string s in it)
@ -20,7 +20,7 @@ public class Example
Console.WriteLine("-- iterator end --");
}
static eina.Array<string> CreateArray()
static Eina.Array<string> CreateArray()
{
string[] strings =
{
@ -30,7 +30,7 @@ public class Example
"boomer"
};
var array = new eina.Array<string>(4u);
var array = new Eina.Array<string>(4u);
foreach (string s in strings)
array.Push(s);
@ -38,7 +38,7 @@ public class Example
return array;
}
static eina.List<string> CreateList()
static Eina.List<string> CreateList()
{
string[] more_strings = {
"sentence strings",
@ -47,7 +47,7 @@ public class Example
"then grab your gun and bring the cat in"
};
var list = new eina.List<string>();
var list = new Eina.List<string>();
foreach (string s in more_strings)
list.Append(s);
@ -57,22 +57,22 @@ public class Example
public static void Main()
{
efl.All.Init();
Efl.All.Init();
// create an eina.Array and iterate through it's contents
// create an Eina.Array and iterate through it's contents
var array = CreateArray();
var it = array.GetIterator();
PrintIterator(it);
it.Dispose();
array.Dispose();
// perform the same iteration with an eina.List
// perform the same iteration with an Eina.List
var list = CreateList();
it = list.GetIterator();
PrintIterator(it);
it.Dispose();
list.Dispose();
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -2,7 +2,7 @@
/*
* Eina List examples.
*
* These examples demonstrate how to work with eina_list data and methods.
* These examples demonstrate how to work with Eina_list data and methods.
* We create a simple list of names by appending strings to an empty list
* and then run various mutations and print each result.
*/
@ -12,9 +12,9 @@ using System.Linq;
public class Example
{
static eina.List<string> CreateList()
static Eina.List<string> CreateList()
{
var list = new eina.List<string>();
var list = new Eina.List<string>();
list.Append("Adama");
list.Append("Baltar");
@ -25,7 +25,7 @@ public class Example
public static void Main()
{
efl.All.Init();
Efl.All.Init();
var list = CreateList();
@ -66,6 +66,6 @@ public class Example
list.Dispose();
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -13,14 +13,14 @@ public class Example
static double Divide(int num, int denom)
{
if (denom == 0)
eina.Log.Critical("Attempt to divide by 0\n");
Eina.Log.Critical("Attempt to divide by 0\n");
else
{
if (denom < 0)
eina.Log.Warning("Possible undesirable effect, divide by negative number");
Eina.Log.Warning("Possible undesirable effect, divide by negative number");
double ret = ((double) num / denom);
eina.Log.Info($"{num} / {denom} = {ret}\n");
Eina.Log.Info($"{num} / {denom} = {ret}\n");
return ret;
}
@ -39,24 +39,24 @@ public class Example
Console.WriteLine("Executing with default logging");
Divides();
eina.Log.GlobalLevelSet(eina.Log.Level.Warning);
Eina.Log.GlobalLevelSet(Eina.Log.Level.Warning);
Console.WriteLine("Executing with Warning level"); // same as EINA_LOG_LEVEL = 2
Divides();
eina.Log.GlobalLevelSet(eina.Log.Level.Info);
Eina.Log.GlobalLevelSet(Eina.Log.Level.Info);
Console.WriteLine("Executing with Info on"); // same as EINA_LOG_LEVEL = 3
Divides();
}
public static void Main()
{
efl.All.Init();
Efl.All.Init();
LogLevels();
// TODO: missing
//LogCustom();
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -1,7 +1,7 @@
/*
* Eina Value examples.
*
* These examples demonstrate how to work with eina_value data and methods.
* These examples demonstrate how to work with Eina_value data and methods.
* Eina_Value is a way to represent and pass data of varying types and to
* convert efficiently between them.
* Eina_Value can even define structs for managing more complex requirements.
@ -16,7 +16,7 @@ public class Example
int i;
// Setting up an integer value type
var int_val = new eina.Value(eina.ValueType.Int32);
var int_val = new Eina.Value(Eina.ValueType.Int32);
int_val.Set(123);
int_val.Get(out i);
Console.WriteLine("int_val value is {0}", i);
@ -31,7 +31,7 @@ public class Example
string str;
// Setting up an string value type
var str_val = new eina.Value(eina.ValueType.String);
var str_val = new Eina.Value(Eina.ValueType.String);
str_val.Set("My string");
str_val.Get(out str);
Console.WriteLine("str_val value is \"{0}\"", str);
@ -44,8 +44,8 @@ public class Example
static void ValueConvert()
{
// Set up string and int types to convert between
var str_val = new eina.Value(eina.ValueType.String);
var int_val = new eina.Value(eina.ValueType.Int32);
var str_val = new Eina.Value(Eina.ValueType.String);
var int_val = new Eina.Value(Eina.ValueType.Int32);
// Convert from int to string:
int i1;
@ -68,7 +68,7 @@ public class Example
public static void Main()
{
efl.All.Init();
Efl.All.Init();
ValueInt();
Console.WriteLine("");
@ -79,6 +79,6 @@ public class Example
ValueConvert();
Console.WriteLine("");
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -4,7 +4,7 @@ public class Example
{
public static void FocusChangedCb(object sender, EventArgs e)
{
Console.WriteLine($"Focus for object {((efl.IText)sender).GetText()} changed to {((efl.ui.IWidget)sender).GetFocus()}");
Console.WriteLine($"Focus for object {((Efl.Text)sender).GetText()} changed to {((Efl.Ui.Widget)sender).GetFocus()}");
}
#if WIN32
@ -13,29 +13,29 @@ public class Example
public static void Main()
{
// Initialize EFL and all UI components
efl.All.Init(efl.Components.Ui);
Efl.All.Init(Efl.Components.Ui);
// Create a window and initialize it
var win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
ewin.SetWinType(efl.ui.Win_Type.Basic);
var win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
ewin.SetWinType(Efl.Ui.WinType.Basic);
ewin.SetText("Focus example");
ewin.SetAutohide(true);
ewin.HideEvt += (object sender, EventArgs e) => {
// Exit the EFL main loop
efl.ui.Config.Exit();
Efl.Ui.Config.Exit();
};
});
// Create the main box container
var vbox = new efl.ui.Box(win, (efl.ui.IBox ebox) => {
ebox.SetHintMin(new eina.Size2D(360, 240));
var vbox = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => {
ebox.SetHintMin(new Eina.Size2D(360, 240));
win.SetContent(ebox);
});
// Create some check boxes
efl.ui.ICheck first_checkbox = null;
Efl.Ui.Check first_checkbox = null;
for (int i = 0; i< 5; i++) {
var checkbox = new efl.ui.Check(vbox, (efl.ui.ICheck echeck) => {
var checkbox = new Efl.Ui.Check(vbox, (Efl.Ui.Check echeck) => {
echeck.SetText("Check " + i);
echeck.SetHintAlign(0.5, 0.5);
echeck.FocusChangedEvt += FocusChangedCb;
@ -45,30 +45,30 @@ public class Example
};
// Create an horizontal box to contain the two buttons
var hbox = new efl.ui.Box(vbox, (efl.ui.IBox ebox) => {
ebox.SetDirection(efl.ui.Dir.Horizontal);
var hbox = new Efl.Ui.Box(vbox, (Efl.Ui.Box ebox) => {
ebox.SetDirection(Efl.Ui.Dir.Horizontal);
vbox.DoPack(ebox);
});
// Create a "Focus Mover" button
new efl.ui.Button(hbox, (efl.ui.IButton ebutton) => {
new Efl.Ui.Button(hbox, (Efl.Ui.Button ebutton) => {
ebutton.SetText("Focus mover");
ebutton.FocusChangedEvt += FocusChangedCb;
ebutton.ClickedEvt += (object sender, EventArgs e) => {
Console.WriteLine("Clicked Focus Mover");
// Manually transfer focus to the first check box
efl.ui.focus.Util.Focus(first_checkbox);
Efl.Ui.Focus.Util.Focus(first_checkbox);
};
hbox.DoPack(ebutton);
});
// Create a Quit button
new efl.ui.Button(hbox, (efl.ui.IButton ebutton) => {
new Efl.Ui.Button(hbox, (Efl.Ui.Button ebutton) => {
ebutton.SetText("Quit");
ebutton.FocusChangedEvt += FocusChangedCb;
ebutton.ClickedEvt += (object sender, EventArgs e) => {
Console.WriteLine("Clicked Quit");
efl.ui.Config.Exit();
Efl.Ui.Config.Exit();
};
hbox.DoPack(ebutton);
});
@ -77,10 +77,10 @@ public class Example
win.SetFocusHighlightEnabled(true);
// Start the EFL main loop
efl.ui.Config.Run();
Efl.Ui.Config.Run();
// Shutdown EFL
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -10,9 +10,9 @@ using System;
public class Example
{
// Create a box container full of buttons
static efl.ui.IBox CreateBox(efl.ui.IWin win)
static Efl.Ui.Box CreateBox(Efl.Ui.Win win)
{
efl.ui.IBox box = new efl.ui.Box(win, (efl.ui.IBox ebox) => {
Efl.Ui.Box box = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => {
// Set distance between contained elements
ebox.SetPackPadding(5, 0, true);
});
@ -20,12 +20,12 @@ public class Example
for (int i = 1; i <= 4; ++i)
{
// Add 4 buttons, one below the other
new efl.ui.Button(win, (efl.ui.IButton ebutton) => {
new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
ebutton.SetText($"Boxed {i}");
if (i == 2)
{
// Button 2 has its maximum size limited, so it will be smaller
ebutton.SetHintMax(new eina.Size2D(100,50));
ebutton.SetHintMax(new Eina.Size2D(100,50));
}
box.DoPack(ebutton);
});
@ -35,25 +35,25 @@ public class Example
}
// Create a simple table layout
static efl.ui.ITable CreateTable(efl.ui.IWin win)
static Efl.Ui.Table CreateTable(Efl.Ui.Win win)
{
efl.ui.ITable table = new efl.ui.Table(win, (efl.ui.ITable etable) => {
Efl.Ui.Table table = new Efl.Ui.Table(win, (Efl.Ui.Table etable) => {
// Table with two columns, that get filled left to right, and then top to bottom
etable.SetTableColumns(2);
etable.SetTableDirection(efl.ui.Dir.Right, efl.ui.Dir.Down);
etable.SetTableDirection(Efl.Ui.Dir.Right, Efl.Ui.Dir.Down);
});
for (int i = 1; i <= 4; ++i)
{
// Add 4 buttons, following the defined table flow
new efl.ui.Button(win, (efl.ui.IButton ebutton) => {
new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
ebutton.SetText($"Table {i}");
table.DoPack(ebutton);
});
}
// Last button spans two table cells
new efl.ui.Button(win, (efl.ui.IButton ebutton) => {
new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
ebutton.SetText("Long Button");
table.PackTable(ebutton, 0, 2, 2, 1);
});
@ -67,62 +67,62 @@ public class Example
public static void Main()
{
// Initialize EFL and all UI components
efl.All.Init(efl.Components.Ui);
Efl.All.Init(Efl.Components.Ui);
// Create a window and initialize it
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
ewin.SetWinType(efl.ui.Win_Type.Basic);
Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
ewin.SetWinType(Efl.Ui.WinType.Basic);
ewin.SetText("Container demo");
ewin.SetAutohide(true);
ewin.HideEvt += (object sender, EventArgs e) => {
// Exit the EFL main loop
efl.ui.Config.Exit();
Efl.Ui.Config.Exit();
};
});
// 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.SetSize(new Eina.Size2D(350,250));
// Create a vertically-split panes container
efl.ui.IPanes vsplit = new efl.ui.Panes(win, (efl.ui.IPanes epanes) => {
Efl.Ui.Panes vsplit = new Efl.Ui.Panes(win, (Efl.Ui.Panes epanes) => {
epanes.SetSplitRatio(0.75);
win.SetContent(epanes);
});
// Create some boxes and set them as the content of the first pane of the container
var box = CreateBox(win);
efl.Content.static_cast(vsplit.GetPart("first")).SetContent(box);
Efl.ContentConcrete.static_cast(vsplit.GetPart("first")).SetContent(box);
// Create a second, horizontally-split panes container and set it as the content of
// the second pane of the first container
efl.ui.IPanes hsplit = new efl.ui.Panes(win, (efl.ui.IPanes epanes) => {
epanes.SetDirection(efl.ui.Dir.Horizontal);
Efl.Ui.Panes hsplit = new Efl.Ui.Panes(win, (Efl.Ui.Panes epanes) => {
epanes.SetDirection(Efl.Ui.Dir.Horizontal);
epanes.SetSplitRatio(0.85);
});
efl.Content.static_cast(vsplit.GetPart("second")).SetContent(hsplit);
Efl.ContentConcrete.static_cast(vsplit.GetPart("second")).SetContent(hsplit);
// Create a table and set it as the content of the first pane of the horizontal
// container
var table = CreateTable(win);
efl.Content.static_cast(hsplit.GetPart("first")).SetContent(table);
Efl.ContentConcrete.static_cast(hsplit.GetPart("first")).SetContent(table);
// Create a button and set it as the content of the second pane of the horizontal
// container
efl.ui.IButton quit_btn = new efl.ui.Button(win, (efl.ui.IButton ebutton) => {
Efl.Ui.Button quit_btn = new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
ebutton.SetText("Quit");
ebutton.SetHintMax(new eina.Size2D(150, 30));
ebutton.SetHintMax(new Eina.Size2D(150, 30));
ebutton.ClickedEvt += (object sender, EventArgs e) => {
// Exit the EFL main loop
efl.ui.Config.Exit();
Efl.Ui.Config.Exit();
};
});
efl.Content.static_cast(hsplit.GetPart("second")).SetContent(quit_btn);
Efl.ContentConcrete.static_cast(hsplit.GetPart("second")).SetContent(quit_btn);
// Start the EFL main loop
efl.ui.Config.Run();
Efl.Ui.Config.Run();
// Shutdown EFL
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -16,49 +16,49 @@ public class Example
public static void Main()
{
// Initialize EFL and all UI components
efl.All.Init(efl.Components.Ui);
Efl.All.Init(Efl.Components.Ui);
// Create a window and initialize it
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
ewin.SetWinType(efl.ui.Win_Type.Basic);
Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
ewin.SetWinType(Efl.Ui.WinType.Basic);
ewin.SetText("Size Control");
ewin.SetAutohide(true);
ewin.HideEvt += (object sender, EventArgs e) => {
// Exit the EFL main loop
efl.ui.Config.Exit();
Efl.Ui.Config.Exit();
};
});
// Create a box container
efl.ui.IBox box = new efl.ui.Box(win, (efl.ui.IBox ebox) => {
Efl.Ui.Box box = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => {
win.SetContent(ebox);
});
// Create a regular button (without size hints)
new efl.ui.Button(win, (efl.ui.IButton ebutton) => {
new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
ebutton.SetText("Button");
box.DoPack(ebutton);
});
// Create a small button (max size is limited)
new efl.ui.Button(win, (efl.ui.IButton ebutton) => {
new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
ebutton.SetText("Small");
ebutton.SetHintMax(new eina.Size2D(50,50));
ebutton.SetHintMax(new Eina.Size2D(50,50));
box.DoPack(ebutton);
});
// Create a big button (min size is limited)
new efl.ui.Button(win, (efl.ui.IButton ebutton) => {
new Efl.Ui.Button(win, (Efl.Ui.Button ebutton) => {
ebutton.SetText("Big button");
ebutton.SetHintMin(new eina.Size2D(100,100));
ebutton.SetHintMin(new Eina.Size2D(100,100));
box.DoPack(ebutton);
});
// Start the EFL main loop
efl.ui.Config.Run();
Efl.Ui.Config.Run();
// Shutdown EFL
efl.All.Shutdown();
Efl.All.Shutdown();
}
}

@ -2,23 +2,23 @@ using System;
public class Example
{
static efl.IModel_Item root, child2;
static Efl.ModelItem root, child2;
// Create our test hierarchy
static void ObjCreate()
{
// First create a root element
root = new efl.Model_Item(null, (efl.IModel_Item eroot) => {
root = new Efl.ModelItem(null, (Efl.ModelItem eroot) => {
eroot.SetName("Root");
});
// Create the first child element
new efl.Model_Item(root, (efl.IModel_Item eroot) => {
new Efl.ModelItem(root, (Efl.ModelItem eroot) => {
eroot.SetName("Child1");
});
// Create the second child element, this time, with an extra reference
child2 = new efl.Model_Item(root, (efl.IModel_Item eroot) => {
child2 = new Efl.ModelItem(root, (Efl.ModelItem eroot) => {
eroot.SetName("Child2");
});
}
@ -37,7 +37,7 @@ public class Example
public static void Main()
{
efl.All.Init(efl.Components.Ui);
Efl.All.Init(Efl.Components.Ui);
// Create all objects
ObjCreate();
@ -45,6 +45,6 @@ public class Example
// Destroy all objects
ObjDestroy();