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
This commit is contained in:
parent
656b746be7
commit
d74a4df994
|
@ -19,7 +19,7 @@ public class LifeBoard
|
||||||
|
|
||||||
private bool[] board;
|
private bool[] board;
|
||||||
private bool[] board1, board2;
|
private bool[] board1, board2;
|
||||||
private efl.ILoop_Timer lifeTimer = null;
|
private Efl.LoopTimer lifeTimer = null;
|
||||||
private LifeRender lifeRender = null;
|
private LifeRender lifeRender = null;
|
||||||
|
|
||||||
private void CellOn(int x, int y)
|
private void CellOn(int x, int y)
|
||||||
|
@ -58,9 +58,9 @@ public class LifeBoard
|
||||||
board = board1;
|
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);
|
etimer.SetInterval(0.1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public class LifeBoard
|
||||||
board = work;
|
board = work;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TogglePause(efl.ui.IWin win)
|
public void TogglePause(Efl.Ui.Win win)
|
||||||
{
|
{
|
||||||
if (lifeTimer != null)
|
if (lifeTimer != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,19 +7,19 @@ public class LifeWindow
|
||||||
|
|
||||||
void ResizeEvt(object sender, EventArgs ev)
|
void ResizeEvt(object sender, EventArgs ev)
|
||||||
{
|
{
|
||||||
lifeRender.RenderLayout((efl.ui.IWin)sender);
|
lifeRender.RenderLayout((Efl.Ui.Win)sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuitEvt(object sender, EventArgs ev)
|
void QuitEvt(object sender, EventArgs ev)
|
||||||
{
|
{
|
||||||
// quit the mainloop
|
// 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;
|
int cellx, celly;
|
||||||
efl.ui.IWin win = (efl.ui.IWin)sender;
|
Efl.Ui.Win win = (Efl.Ui.Win)sender;
|
||||||
var position = ev.arg.GetPosition();
|
var position = ev.arg.GetPosition();
|
||||||
lifeRender.CellForCoords(win, position, out cellx, out celly);
|
lifeRender.CellForCoords(win, position, out cellx, out celly);
|
||||||
|
|
||||||
|
@ -28,25 +28,25 @@ public class LifeWindow
|
||||||
lifeRender.RenderCell(win, cellx, celly);
|
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")
|
if (ev.arg.GetKey() == "space")
|
||||||
lifeBoard.TogglePause(win);
|
lifeBoard.TogglePause(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LifeWindow()
|
public LifeWindow()
|
||||||
{
|
{
|
||||||
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
|
Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
|
||||||
ewin.SetWinType(efl.ui.Win_Type.Basic);
|
ewin.SetWinType(Efl.Ui.WinType.Basic);
|
||||||
ewin.SetText("EFL Life");
|
ewin.SetText("EFL Life");
|
||||||
ewin.SetAutohide(true);
|
ewin.SetAutohide(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// when the user clicks "close" on a window there is a request to hide
|
// 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.W = (int)(10 * LifeBoard.Width * win.GetScale());
|
||||||
sz.H = (int)(10 * LifeBoard.Height * win.GetScale());
|
sz.H = (int)(10 * LifeBoard.Height * win.GetScale());
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ public class LifeWindow
|
||||||
lifeRender = new LifeRender(win, lifeBoard);
|
lifeRender = new LifeRender(win, lifeBoard);
|
||||||
lifeRender.Refresh(win);
|
lifeRender.Refresh(win);
|
||||||
|
|
||||||
win.ResizeEvt += ResizeEvt;
|
((Efl.Gfx.Entity)win).ResizeEvt += ResizeEvt;
|
||||||
win.PointerDownEvt += TouchEvt;
|
((Efl.Input.Interface)win).PointerDownEvt += TouchEvt;
|
||||||
win.KeyDownEvt += KeyDownEvt;
|
((Efl.Input.Interface)win).KeyDownEvt += KeyDownEvt;
|
||||||
|
|
||||||
win.SetSize(sz);
|
win.SetSize(sz);
|
||||||
|
|
||||||
|
@ -68,13 +68,13 @@ public class Example
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
var lifeWin = new LifeWindow();
|
var lifeWin = new LifeWindow();
|
||||||
|
|
||||||
// start the mainloop
|
// 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
|
public class LifeRender
|
||||||
{
|
{
|
||||||
private efl.canvas.IRectangle[] lifeCells;
|
private Efl.Canvas.Rectangle[] lifeCells;
|
||||||
private LifeBoard lifeBoard;
|
private LifeBoard lifeBoard;
|
||||||
|
|
||||||
public LifeRender(efl.ui.IWin win, LifeBoard board)
|
public LifeRender(Efl.Ui.Win win, LifeBoard board)
|
||||||
{
|
{
|
||||||
lifeBoard = board;
|
lifeBoard = board;
|
||||||
lifeBoard.SetRender(this);
|
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 y = 0; y < LifeBoard.Height; ++y)
|
||||||
for (int x = 0; x < LifeBoard.Width; ++x)
|
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);
|
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;
|
x = coord.X * LifeBoard.Width / size.W;
|
||||||
y = coord.Y * LifeBoard.Height / size.H;
|
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 cw = (double) size.W / LifeBoard.Width;
|
||||||
double ch = (double) size.H / LifeBoard.Height;
|
double ch = (double) size.H / LifeBoard.Height;
|
||||||
|
|
||||||
|
@ -39,19 +39,19 @@ public class LifeRender
|
||||||
var rect = lifeCells[LifeBoard.IndexForPosition(x, y)];
|
var rect = lifeCells[LifeBoard.IndexForPosition(x, y)];
|
||||||
|
|
||||||
// the little +1 here will avoid tearing as we layout non-multiple sizes
|
// 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.W = (int)(cw + 1);
|
||||||
sz.H = (int)(ch + 1);
|
sz.H = (int)(ch + 1);
|
||||||
rect.SetSize(sz);
|
rect.SetSize(sz);
|
||||||
|
|
||||||
eina.Position2D pos;
|
Eina.Position2D pos;
|
||||||
pos.X = (int)(x * cw);
|
pos.X = (int)(x * cw);
|
||||||
pos.Y = (int)(y * ch);
|
pos.Y = (int)(y * ch);
|
||||||
rect.SetPosition(pos);
|
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);
|
int i = LifeBoard.IndexForPosition(x, y);
|
||||||
var rect = lifeCells[i];
|
var rect = lifeCells[i];
|
||||||
|
@ -62,7 +62,7 @@ public class LifeRender
|
||||||
rect.SetColor(255, 255, 255, 255);
|
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 y = 0; y < LifeBoard.Height; ++y)
|
||||||
for (int x = 0; x < LifeBoard.Width; ++x)
|
for (int x = 0; x < LifeBoard.Width; ++x)
|
||||||
|
|
|
@ -19,11 +19,11 @@ using System;
|
||||||
|
|
||||||
public class TextEditor
|
public class TextEditor
|
||||||
{
|
{
|
||||||
private efl.ui.IWin win; // The main window
|
private Efl.Ui.Win win; // The main window
|
||||||
private efl.ui.IText editorTextBox; // The main text entry
|
private Efl.Ui.Text editorTextBox; // The main text entry
|
||||||
private efl.ui.IButton toolbarButtonNew; // The "New" button in the toolbar
|
private Efl.Ui.Button toolbarButtonNew; // The "New" button in the toolbar
|
||||||
private efl.ui.IButton toolbarButtonSave; // The "Save" button in the toolbar
|
private Efl.Ui.Button toolbarButtonSave; // The "Save" button in the toolbar
|
||||||
private efl.ui.IButton toolbarButtonLoad; // The "Load" 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
|
private bool edited = false; // Document was edited since last save
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class TextEditor
|
||||||
// Quits the application
|
// Quits the application
|
||||||
private void GUIQuitCb(object sender, EventArgs ea)
|
private void GUIQuitCb(object sender, EventArgs ea)
|
||||||
{
|
{
|
||||||
efl.ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enables or disables buttons on the toolbar as required
|
// 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
|
// Shows a modal message popup with an "OK" button
|
||||||
private void ShowMessage(string message)
|
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.SetText(message);
|
||||||
epopup.SetExpandable(new eina.Size2D(200,200));
|
epopup.SetExpandable(new Eina.Size2D(200,200));
|
||||||
epopup.SetButton(efl.ui.Alert_Popup_Button.Positive, "OK", null);
|
epopup.SetButton(Efl.Ui.AlertPopupButton.Positive, "OK", null);
|
||||||
epopup.ButtonClickedEvt +=
|
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
|
// 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
|
// 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)
|
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.SetText(name);
|
||||||
ebutton.ClickedEvt += func;
|
ebutton.ClickedEvt += func;
|
||||||
ebutton.SetHintWeight(0, 1);
|
ebutton.SetHintWeight(0, 1);
|
||||||
toolbar.DoPack(ebutton);
|
toolbar.DoPack(ebutton);
|
||||||
|
|
||||||
// Set the content of the button
|
// Set the content of the button
|
||||||
efl.Content.static_cast(ebutton.GetPart("efl.content")).SetContent(
|
ebutton.SetContent(
|
||||||
// Which is an image
|
// 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);
|
eimage.SetIcon(iconName);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -91,15 +91,15 @@ public class TextEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new toolbar, with all its buttons
|
// 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
|
// 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
|
// 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
|
// 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.
|
// space will be given to the other object in the parent container.
|
||||||
ebox.SetHintWeight(1, 0);
|
ebox.SetHintWeight(1, 0);
|
||||||
ebox.SetDirection(efl.ui.Dir.Horizontal);
|
ebox.SetDirection(Efl.Ui.Dir.Horizontal);
|
||||||
parent.DoPack(ebox);
|
parent.DoPack(ebox);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ public class TextEditor
|
||||||
// a horizontal weight of 0).
|
// a horizontal weight of 0).
|
||||||
// As a result, it pushes the "Quit" button to the right margin and
|
// As a result, it pushes the "Quit" button to the right margin and
|
||||||
// the rest to the left.
|
// 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);
|
bar.DoPack(box);
|
||||||
|
|
||||||
// "Quit" button
|
// "Quit" button
|
||||||
|
@ -157,26 +157,26 @@ public class TextEditor
|
||||||
public TextEditor()
|
public TextEditor()
|
||||||
{
|
{
|
||||||
// Create a window and initialize it
|
// 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.SetText("Text Editor");
|
||||||
ewin.SetAutohide(true);
|
ewin.SetAutohide(true);
|
||||||
ewin.HideEvt += GUIQuitCb;
|
ewin.HideEvt += GUIQuitCb;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a vertical box container
|
// 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);
|
win.SetContent(box);
|
||||||
|
|
||||||
// Create the toolbar and add it to the box
|
// Create the toolbar and add it to the box
|
||||||
GUIToolbarSetup(box);
|
GUIToolbarSetup(box);
|
||||||
|
|
||||||
// Create the main text entry
|
// 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.SetFont("Mono", 14);
|
||||||
etext.SetMultiline(true);
|
etext.SetMultiline(true);
|
||||||
etext.SetEditable(true);
|
etext.SetEditable(true);
|
||||||
etext.SetScrollable(true);
|
etext.SetScrollable(true);
|
||||||
etext.SetHintMin(new eina.Size2D(360, 240));
|
etext.SetHintMin(new Eina.Size2D(360, 240));
|
||||||
etext.ChangedEvt += EditorChangedCb;
|
etext.ChangedEvt += EditorChangedCb;
|
||||||
etext.ChangedUserEvt += EditorChangedCb;
|
etext.ChangedUserEvt += EditorChangedCb;
|
||||||
box.DoPack(etext);
|
box.DoPack(etext);
|
||||||
|
@ -190,7 +190,7 @@ public class TextEditor
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
// Start the EFL main loop
|
// Start the EFL main loop
|
||||||
efl.ui.Config.Run();
|
Efl.Ui.Config.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,13 +202,13 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
var textEditor = new TextEditor();
|
var textEditor = new TextEditor();
|
||||||
textEditor.Run();
|
textEditor.Run();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class Example
|
||||||
// Polling callback
|
// Polling callback
|
||||||
private static void PollCb(object sender, EventArgs e)
|
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
|
#if WIN32
|
||||||
|
@ -21,17 +21,17 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
// Retrieve the application's main loop
|
// Retrieve the application's main loop
|
||||||
var mainloop = efl.App.GetLoopMain();
|
var mainloop = Efl.App.GetLoopMain();
|
||||||
mainloop.SetName("Mainloop");
|
mainloop.SetName("Mainloop");
|
||||||
|
|
||||||
// This event gets triggered continuously
|
// This event gets triggered continuously
|
||||||
mainloop.PollHighEvt += PollCb;
|
mainloop.PollHighEvt += PollCb;
|
||||||
|
|
||||||
// This timer will control events fired by the main loop
|
// 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");
|
etimer.SetName("Timer");
|
||||||
// Trigger every 100ms
|
// Trigger every 100ms
|
||||||
etimer.SetInterval(0.1);
|
etimer.SetInterval(0.1);
|
||||||
|
@ -51,10 +51,10 @@ public class Example
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
message += "Quitting";
|
message += "Quitting";
|
||||||
mainloop.Quit(new eina.Value(0));
|
mainloop.Quit(new Eina.Value(0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Console.WriteLine(message, tick_count, ((efl.IObject)sender).GetName());
|
Console.WriteLine(message, tick_count, ((Efl.Object)sender).GetName());
|
||||||
tick_count++;
|
tick_count++;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -65,7 +65,7 @@ public class Example
|
||||||
mainloop.Begin();
|
mainloop.Begin();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
|
|
||||||
Console.WriteLine("Application is over");
|
Console.WriteLine("Application is over");
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
// Retrieve the application's main loop
|
// Retrieve the application's main loop
|
||||||
var mainloop = efl.App.GetLoopMain();
|
var mainloop = Efl.App.GetLoopMain();
|
||||||
|
|
||||||
// Register to all Idle events
|
// Register to all Idle events
|
||||||
mainloop.IdleEnterEvt += (object sender, EventArgs e) => {
|
mainloop.IdleEnterEvt += (object sender, EventArgs e) => {
|
||||||
|
@ -34,12 +34,12 @@ public class Example
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use a timer to exit the application
|
// 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
|
// Trigger after 10ms
|
||||||
etimer.SetInterval(0.01);
|
etimer.SetInterval(0.01);
|
||||||
etimer.TickEvt += (object sender, EventArgs e) => {
|
etimer.TickEvt += (object sender, EventArgs e) => {
|
||||||
Console.WriteLine("TIMER: timer callback called, exiting.");
|
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();
|
mainloop.Begin();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,10 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
// Retrieve the application's main loop
|
// Retrieve the application's main loop
|
||||||
var mainloop = efl.App.GetLoopMain();
|
var mainloop = Efl.App.GetLoopMain();
|
||||||
|
|
||||||
// Register to all Poll events
|
// Register to all Poll events
|
||||||
mainloop.PollLowEvt += (object sender, EventArgs e) => {
|
mainloop.PollLowEvt += (object sender, EventArgs e) => {
|
||||||
|
@ -33,12 +33,12 @@ public class Example
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use a timer to exit the application
|
// 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
|
// Trigger after 30s
|
||||||
etimer.SetInterval(30);
|
etimer.SetInterval(30);
|
||||||
etimer.TickEvt += (object sender, EventArgs e) => {
|
etimer.TickEvt += (object sender, EventArgs e) => {
|
||||||
Console.WriteLine("\nTIMER: timer callback called, exiting.");
|
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();
|
mainloop.Begin();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Eina Array examples.
|
* Eina Array examples.
|
||||||
*
|
*
|
||||||
* These examples demonstrate how to work with eina_array data and methods.
|
* 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
|
* We use a simple array of strings to initialise our Eina_array before
|
||||||
* performing various mutations and printing the results.
|
* performing various mutations and printing the results.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ using System;
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
static eina.Array<string> CreateArray()
|
static Eina.Array<string> CreateArray()
|
||||||
{
|
{
|
||||||
// some content to populate our array
|
// some content to populate our array
|
||||||
string[] names =
|
string[] names =
|
||||||
|
@ -22,7 +22,7 @@ public class Example
|
||||||
};
|
};
|
||||||
|
|
||||||
// set up an array with a growth step to give a little headroom
|
// 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)
|
foreach (string name in names)
|
||||||
array.Push(name);
|
array.Push(name);
|
||||||
|
@ -40,7 +40,7 @@ public class Example
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
var array = CreateArray();
|
var array = CreateArray();
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class Example
|
||||||
|
|
||||||
array.Dispose();
|
array.Dispose();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Eina Hash examples.
|
* 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
|
* We have two main hash objects here, firstly an int keyed hash with some
|
||||||
* dummy content.
|
* dummy content.
|
||||||
|
@ -14,10 +14,10 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
public class Example
|
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
|
// 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
|
// Add initial entries to our hash
|
||||||
for (int i = 0; i < 10; ++i)
|
for (int i = 0; i < 10; ++i)
|
||||||
|
@ -53,7 +53,7 @@ public class Example
|
||||||
Console.WriteLine($" Name: {key}\tNumber {data}\n");
|
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();
|
int count = book.Population();
|
||||||
Console.WriteLine($"Complete phone book ({count}):");
|
Console.WriteLine($"Complete phone book ({count}):");
|
||||||
|
@ -65,7 +65,7 @@ public class Example
|
||||||
Console.WriteLine("");
|
Console.WriteLine("");
|
||||||
}
|
}
|
||||||
|
|
||||||
static eina.Hash<string, string> CreatePhonebook()
|
static Eina.Hash<string, string> CreatePhonebook()
|
||||||
{
|
{
|
||||||
string[] names =
|
string[] names =
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ public class Example
|
||||||
};
|
};
|
||||||
|
|
||||||
// create hash of strings to strings
|
// 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
|
// Add initial entries to our hash
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
|
@ -119,11 +119,11 @@ public class Example
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
HashDemo();
|
HashDemo();
|
||||||
PhonebookDemo();
|
PhonebookDemo();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
/*
|
/*
|
||||||
* Eina Iterator examples.
|
* Eina Iterator examples.
|
||||||
*
|
*
|
||||||
* These examples demonstrate how to work with eina_iterator methods.
|
* These examples demonstrate how to work with Eina_iterator methods.
|
||||||
* Both an eina_list and an eina_array are created and an iterator obtained
|
* 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
|
* 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.
|
* and also that there are different ways to work with iterating content.
|
||||||
*/
|
*/
|
||||||
|
@ -12,7 +12,7 @@ using System;
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
static void PrintIterator(eina.Iterator<string> it)
|
static void PrintIterator(Eina.Iterator<string> it)
|
||||||
{
|
{
|
||||||
Console.WriteLine("--iterator start--");
|
Console.WriteLine("--iterator start--");
|
||||||
foreach(string s in it)
|
foreach(string s in it)
|
||||||
|
@ -20,7 +20,7 @@ public class Example
|
||||||
Console.WriteLine("-- iterator end --");
|
Console.WriteLine("-- iterator end --");
|
||||||
}
|
}
|
||||||
|
|
||||||
static eina.Array<string> CreateArray()
|
static Eina.Array<string> CreateArray()
|
||||||
{
|
{
|
||||||
string[] strings =
|
string[] strings =
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ public class Example
|
||||||
"boomer"
|
"boomer"
|
||||||
};
|
};
|
||||||
|
|
||||||
var array = new eina.Array<string>(4u);
|
var array = new Eina.Array<string>(4u);
|
||||||
|
|
||||||
foreach (string s in strings)
|
foreach (string s in strings)
|
||||||
array.Push(s);
|
array.Push(s);
|
||||||
|
@ -38,7 +38,7 @@ public class Example
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
static eina.List<string> CreateList()
|
static Eina.List<string> CreateList()
|
||||||
{
|
{
|
||||||
string[] more_strings = {
|
string[] more_strings = {
|
||||||
"sentence strings",
|
"sentence strings",
|
||||||
|
@ -47,7 +47,7 @@ public class Example
|
||||||
"then grab your gun and bring the cat in"
|
"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)
|
foreach (string s in more_strings)
|
||||||
list.Append(s);
|
list.Append(s);
|
||||||
|
@ -57,22 +57,22 @@ public class Example
|
||||||
|
|
||||||
public static void Main()
|
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 array = CreateArray();
|
||||||
var it = array.GetIterator();
|
var it = array.GetIterator();
|
||||||
PrintIterator(it);
|
PrintIterator(it);
|
||||||
it.Dispose();
|
it.Dispose();
|
||||||
array.Dispose();
|
array.Dispose();
|
||||||
|
|
||||||
// perform the same iteration with an eina.List
|
// perform the same iteration with an Eina.List
|
||||||
var list = CreateList();
|
var list = CreateList();
|
||||||
it = list.GetIterator();
|
it = list.GetIterator();
|
||||||
PrintIterator(it);
|
PrintIterator(it);
|
||||||
it.Dispose();
|
it.Dispose();
|
||||||
list.Dispose();
|
list.Dispose();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Eina List examples.
|
* 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
|
* We create a simple list of names by appending strings to an empty list
|
||||||
* and then run various mutations and print each result.
|
* and then run various mutations and print each result.
|
||||||
*/
|
*/
|
||||||
|
@ -12,9 +12,9 @@ using System.Linq;
|
||||||
|
|
||||||
public class Example
|
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("Adama");
|
||||||
list.Append("Baltar");
|
list.Append("Baltar");
|
||||||
|
@ -25,7 +25,7 @@ public class Example
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
var list = CreateList();
|
var list = CreateList();
|
||||||
|
|
||||||
|
@ -66,6 +66,6 @@ public class Example
|
||||||
|
|
||||||
list.Dispose();
|
list.Dispose();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,14 @@ public class Example
|
||||||
static double Divide(int num, int denom)
|
static double Divide(int num, int denom)
|
||||||
{
|
{
|
||||||
if (denom == 0)
|
if (denom == 0)
|
||||||
eina.Log.Critical("Attempt to divide by 0\n");
|
Eina.Log.Critical("Attempt to divide by 0\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (denom < 0)
|
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);
|
double ret = ((double) num / denom);
|
||||||
eina.Log.Info($"{num} / {denom} = {ret}\n");
|
Eina.Log.Info($"{num} / {denom} = {ret}\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,24 +39,24 @@ public class Example
|
||||||
Console.WriteLine("Executing with default logging");
|
Console.WriteLine("Executing with default logging");
|
||||||
Divides();
|
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
|
Console.WriteLine("Executing with Warning level"); // same as EINA_LOG_LEVEL = 2
|
||||||
Divides();
|
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
|
Console.WriteLine("Executing with Info on"); // same as EINA_LOG_LEVEL = 3
|
||||||
Divides();
|
Divides();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
LogLevels();
|
LogLevels();
|
||||||
|
|
||||||
// TODO: missing
|
// TODO: missing
|
||||||
//LogCustom();
|
//LogCustom();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Eina Value examples.
|
* 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
|
* Eina_Value is a way to represent and pass data of varying types and to
|
||||||
* convert efficiently between them.
|
* convert efficiently between them.
|
||||||
* Eina_Value can even define structs for managing more complex requirements.
|
* Eina_Value can even define structs for managing more complex requirements.
|
||||||
|
@ -16,7 +16,7 @@ public class Example
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Setting up an integer value type
|
// 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.Set(123);
|
||||||
int_val.Get(out i);
|
int_val.Get(out i);
|
||||||
Console.WriteLine("int_val value is {0}", i);
|
Console.WriteLine("int_val value is {0}", i);
|
||||||
|
@ -31,7 +31,7 @@ public class Example
|
||||||
string str;
|
string str;
|
||||||
|
|
||||||
// Setting up an string value type
|
// 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.Set("My string");
|
||||||
str_val.Get(out str);
|
str_val.Get(out str);
|
||||||
Console.WriteLine("str_val value is \"{0}\"", str);
|
Console.WriteLine("str_val value is \"{0}\"", str);
|
||||||
|
@ -44,8 +44,8 @@ public class Example
|
||||||
static void ValueConvert()
|
static void ValueConvert()
|
||||||
{
|
{
|
||||||
// Set up string and int types to convert between
|
// Set up string and int types to convert between
|
||||||
var str_val = new eina.Value(eina.ValueType.String);
|
var str_val = new Eina.Value(Eina.ValueType.String);
|
||||||
var int_val = new eina.Value(eina.ValueType.Int32);
|
var int_val = new Eina.Value(Eina.ValueType.Int32);
|
||||||
|
|
||||||
// Convert from int to string:
|
// Convert from int to string:
|
||||||
int i1;
|
int i1;
|
||||||
|
@ -68,7 +68,7 @@ public class Example
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
ValueInt();
|
ValueInt();
|
||||||
Console.WriteLine("");
|
Console.WriteLine("");
|
||||||
|
@ -79,6 +79,6 @@ public class Example
|
||||||
ValueConvert();
|
ValueConvert();
|
||||||
Console.WriteLine("");
|
Console.WriteLine("");
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ public class Example
|
||||||
{
|
{
|
||||||
public static void FocusChangedCb(object sender, EventArgs e)
|
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
|
#if WIN32
|
||||||
|
@ -13,29 +13,29 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
// Create a window and initialize it
|
// Create a window and initialize it
|
||||||
var win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
|
var win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
|
||||||
ewin.SetWinType(efl.ui.Win_Type.Basic);
|
ewin.SetWinType(Efl.Ui.WinType.Basic);
|
||||||
ewin.SetText("Focus example");
|
ewin.SetText("Focus example");
|
||||||
ewin.SetAutohide(true);
|
ewin.SetAutohide(true);
|
||||||
ewin.HideEvt += (object sender, EventArgs e) => {
|
ewin.HideEvt += (object sender, EventArgs e) => {
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
efl.ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create the main box container
|
// Create the main box container
|
||||||
var vbox = new efl.ui.Box(win, (efl.ui.IBox ebox) => {
|
var vbox = new Efl.Ui.Box(win, (Efl.Ui.Box ebox) => {
|
||||||
ebox.SetHintMin(new eina.Size2D(360, 240));
|
ebox.SetHintMin(new Eina.Size2D(360, 240));
|
||||||
win.SetContent(ebox);
|
win.SetContent(ebox);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create some check boxes
|
// Create some check boxes
|
||||||
efl.ui.ICheck first_checkbox = null;
|
Efl.Ui.Check first_checkbox = null;
|
||||||
for (int i = 0; i< 5; i++) {
|
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.SetText("Check " + i);
|
||||||
echeck.SetHintAlign(0.5, 0.5);
|
echeck.SetHintAlign(0.5, 0.5);
|
||||||
echeck.FocusChangedEvt += FocusChangedCb;
|
echeck.FocusChangedEvt += FocusChangedCb;
|
||||||
|
@ -45,30 +45,30 @@ public class Example
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create an horizontal box to contain the two buttons
|
// Create an horizontal box to contain the two buttons
|
||||||
var hbox = new efl.ui.Box(vbox, (efl.ui.IBox ebox) => {
|
var hbox = new Efl.Ui.Box(vbox, (Efl.Ui.Box ebox) => {
|
||||||
ebox.SetDirection(efl.ui.Dir.Horizontal);
|
ebox.SetDirection(Efl.Ui.Dir.Horizontal);
|
||||||
vbox.DoPack(ebox);
|
vbox.DoPack(ebox);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a "Focus Mover" button
|
// 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.SetText("Focus mover");
|
||||||
ebutton.FocusChangedEvt += FocusChangedCb;
|
ebutton.FocusChangedEvt += FocusChangedCb;
|
||||||
ebutton.ClickedEvt += (object sender, EventArgs e) => {
|
ebutton.ClickedEvt += (object sender, EventArgs e) => {
|
||||||
Console.WriteLine("Clicked Focus Mover");
|
Console.WriteLine("Clicked Focus Mover");
|
||||||
// Manually transfer focus to the first check box
|
// 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);
|
hbox.DoPack(ebutton);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a Quit button
|
// 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.SetText("Quit");
|
||||||
ebutton.FocusChangedEvt += FocusChangedCb;
|
ebutton.FocusChangedEvt += FocusChangedCb;
|
||||||
ebutton.ClickedEvt += (object sender, EventArgs e) => {
|
ebutton.ClickedEvt += (object sender, EventArgs e) => {
|
||||||
Console.WriteLine("Clicked Quit");
|
Console.WriteLine("Clicked Quit");
|
||||||
efl.ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
};
|
};
|
||||||
hbox.DoPack(ebutton);
|
hbox.DoPack(ebutton);
|
||||||
});
|
});
|
||||||
|
@ -77,10 +77,10 @@ public class Example
|
||||||
win.SetFocusHighlightEnabled(true);
|
win.SetFocusHighlightEnabled(true);
|
||||||
|
|
||||||
// Start the EFL main loop
|
// Start the EFL main loop
|
||||||
efl.ui.Config.Run();
|
Efl.Ui.Config.Run();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ using System;
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
// Create a box container full of buttons
|
// 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
|
// Set distance between contained elements
|
||||||
ebox.SetPackPadding(5, 0, true);
|
ebox.SetPackPadding(5, 0, true);
|
||||||
});
|
});
|
||||||
|
@ -20,12 +20,12 @@ public class Example
|
||||||
for (int i = 1; i <= 4; ++i)
|
for (int i = 1; i <= 4; ++i)
|
||||||
{
|
{
|
||||||
// Add 4 buttons, one below the other
|
// 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}");
|
ebutton.SetText($"Boxed {i}");
|
||||||
if (i == 2)
|
if (i == 2)
|
||||||
{
|
{
|
||||||
// Button 2 has its maximum size limited, so it will be smaller
|
// 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);
|
box.DoPack(ebutton);
|
||||||
});
|
});
|
||||||
|
@ -35,25 +35,25 @@ public class Example
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a simple table layout
|
// 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
|
// Table with two columns, that get filled left to right, and then top to bottom
|
||||||
etable.SetTableColumns(2);
|
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)
|
for (int i = 1; i <= 4; ++i)
|
||||||
{
|
{
|
||||||
// Add 4 buttons, following the defined table flow
|
// 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}");
|
ebutton.SetText($"Table {i}");
|
||||||
table.DoPack(ebutton);
|
table.DoPack(ebutton);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last button spans two table cells
|
// 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");
|
ebutton.SetText("Long Button");
|
||||||
table.PackTable(ebutton, 0, 2, 2, 1);
|
table.PackTable(ebutton, 0, 2, 2, 1);
|
||||||
});
|
});
|
||||||
|
@ -67,62 +67,62 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
// Create a window and initialize it
|
// Create a window and initialize it
|
||||||
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
|
Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
|
||||||
ewin.SetWinType(efl.ui.Win_Type.Basic);
|
ewin.SetWinType(Efl.Ui.WinType.Basic);
|
||||||
ewin.SetText("Container demo");
|
ewin.SetText("Container demo");
|
||||||
ewin.SetAutohide(true);
|
ewin.SetAutohide(true);
|
||||||
ewin.HideEvt += (object sender, EventArgs e) => {
|
ewin.HideEvt += (object sender, EventArgs e) => {
|
||||||
// Exit the EFL main loop
|
// 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.
|
// Give the window an initial size so there is room to resize the panes.
|
||||||
// Otherwise, all widgets are tightly packed
|
// 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
|
// 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);
|
epanes.SetSplitRatio(0.75);
|
||||||
win.SetContent(epanes);
|
win.SetContent(epanes);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create some boxes and set them as the content of the first pane of the container
|
// Create some boxes and set them as the content of the first pane of the container
|
||||||
var box = CreateBox(win);
|
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
|
// Create a second, horizontally-split panes container and set it as the content of
|
||||||
// the second pane of the first container
|
// the second pane of the first container
|
||||||
efl.ui.IPanes hsplit = new efl.ui.Panes(win, (efl.ui.IPanes epanes) => {
|
Efl.Ui.Panes hsplit = new Efl.Ui.Panes(win, (Efl.Ui.Panes epanes) => {
|
||||||
epanes.SetDirection(efl.ui.Dir.Horizontal);
|
epanes.SetDirection(Efl.Ui.Dir.Horizontal);
|
||||||
epanes.SetSplitRatio(0.85);
|
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
|
// Create a table and set it as the content of the first pane of the horizontal
|
||||||
// container
|
// container
|
||||||
var table = CreateTable(win);
|
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
|
// Create a button and set it as the content of the second pane of the horizontal
|
||||||
// container
|
// 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.SetText("Quit");
|
||||||
ebutton.SetHintMax(new eina.Size2D(150, 30));
|
ebutton.SetHintMax(new Eina.Size2D(150, 30));
|
||||||
ebutton.ClickedEvt += (object sender, EventArgs e) => {
|
ebutton.ClickedEvt += (object sender, EventArgs e) => {
|
||||||
// Exit the EFL main loop
|
// 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
|
// Start the EFL main loop
|
||||||
efl.ui.Config.Run();
|
Efl.Ui.Config.Run();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,49 +16,49 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
// Create a window and initialize it
|
// Create a window and initialize it
|
||||||
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
|
Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
|
||||||
ewin.SetWinType(efl.ui.Win_Type.Basic);
|
ewin.SetWinType(Efl.Ui.WinType.Basic);
|
||||||
ewin.SetText("Size Control");
|
ewin.SetText("Size Control");
|
||||||
ewin.SetAutohide(true);
|
ewin.SetAutohide(true);
|
||||||
ewin.HideEvt += (object sender, EventArgs e) => {
|
ewin.HideEvt += (object sender, EventArgs e) => {
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
efl.ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a box container
|
// 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);
|
win.SetContent(ebox);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a regular button (without size hints)
|
// 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");
|
ebutton.SetText("Button");
|
||||||
box.DoPack(ebutton);
|
box.DoPack(ebutton);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a small button (max size is limited)
|
// 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.SetText("Small");
|
||||||
ebutton.SetHintMax(new eina.Size2D(50,50));
|
ebutton.SetHintMax(new Eina.Size2D(50,50));
|
||||||
box.DoPack(ebutton);
|
box.DoPack(ebutton);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a big button (min size is limited)
|
// 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.SetText("Big button");
|
||||||
ebutton.SetHintMin(new eina.Size2D(100,100));
|
ebutton.SetHintMin(new Eina.Size2D(100,100));
|
||||||
box.DoPack(ebutton);
|
box.DoPack(ebutton);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start the EFL main loop
|
// Start the EFL main loop
|
||||||
efl.ui.Config.Run();
|
Efl.Ui.Config.Run();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,23 +2,23 @@ using System;
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
static efl.IModel_Item root, child2;
|
static Efl.ModelItem root, child2;
|
||||||
|
|
||||||
// Create our test hierarchy
|
// Create our test hierarchy
|
||||||
static void ObjCreate()
|
static void ObjCreate()
|
||||||
{
|
{
|
||||||
// First create a root element
|
// 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");
|
eroot.SetName("Root");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create the first child element
|
// Create the first child element
|
||||||
new efl.Model_Item(root, (efl.IModel_Item eroot) => {
|
new Efl.ModelItem(root, (Efl.ModelItem eroot) => {
|
||||||
eroot.SetName("Child1");
|
eroot.SetName("Child1");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create the second child element, this time, with an extra reference
|
// 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");
|
eroot.SetName("Child2");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class Example
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
// Create all objects
|
// Create all objects
|
||||||
ObjCreate();
|
ObjCreate();
|
||||||
|
@ -45,6 +45,6 @@ public class Example
|
||||||
// Destroy all objects
|
// Destroy all objects
|
||||||
ObjDestroy();
|
ObjDestroy();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ public class Example
|
||||||
public static void QuitCb(object sender, EventArgs e)
|
public static void QuitCb(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
efl.ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WIN32
|
#if WIN32
|
||||||
|
@ -15,10 +15,10 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
// Create a window and initialize it
|
// Create a window and initialize it
|
||||||
efl.ui.IWin win = new efl.ui.Win(efl.App.GetLoopMain(), (efl.ui.IWin ewin) => {
|
Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.GetLoopMain(), (Efl.Ui.Win ewin) => {
|
||||||
// Set the window's title
|
// Set the window's title
|
||||||
ewin.SetText("Hello World");
|
ewin.SetText("Hello World");
|
||||||
// Request that the window is automatically hidden when the "close"
|
// Request that the window is automatically hidden when the "close"
|
||||||
|
@ -29,16 +29,16 @@ public class Example
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a box container
|
// 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) => {
|
||||||
// Set its minimum size
|
// Set its minimum size
|
||||||
ebox.SetHintMin(new eina.Size2D(360, 240));
|
ebox.SetHintMin(new Eina.Size2D(360, 240));
|
||||||
// Set the box as the content for the window
|
// Set the box as the content for the window
|
||||||
// The window size will adapt to the box size
|
// The window size will adapt to the box size
|
||||||
win.SetContent(ebox);
|
win.SetContent(ebox);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a text label widget
|
// Create a text label widget
|
||||||
new efl.ui.Text(box, (efl.ui.IText etext) => {
|
new Efl.Ui.Text(box, (Efl.Ui.Text etext) => {
|
||||||
// Set its content and customize it
|
// Set its content and customize it
|
||||||
etext.SetText("Hello World. This is an Efl.Ui application!");
|
etext.SetText("Hello World. This is an Efl.Ui application!");
|
||||||
etext.SetSelectionAllowed(false);
|
etext.SetSelectionAllowed(false);
|
||||||
|
@ -49,7 +49,7 @@ public class Example
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create a button widget
|
// Create a button widget
|
||||||
new efl.ui.Button(box, (efl.ui.IButton ebutton) => {
|
new Efl.Ui.Button(box, (Efl.Ui.Button ebutton) => {
|
||||||
// Customize it
|
// Customize it
|
||||||
ebutton.SetText("Quit");
|
ebutton.SetText("Quit");
|
||||||
ebutton.SetHintWeight(1.0, 0.1);
|
ebutton.SetHintWeight(1.0, 0.1);
|
||||||
|
@ -60,10 +60,10 @@ public class Example
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start the EFL main loop
|
// Start the EFL main loop
|
||||||
efl.ui.Config.Run();
|
Efl.Ui.Config.Run();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ public class Example
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
// Initialize EFL and all UI components
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
// Create a window and initialize it
|
// Create a window and initialize it
|
||||||
efl.ui.IWin win = new efl.ui.Win(efl.App.GetLoopMain(), (efl.ui.IWin ewin) => {
|
Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.GetLoopMain(), (Efl.Ui.Win ewin) => {
|
||||||
// Set the window's title
|
// Set the window's title
|
||||||
ewin.SetText("Hello World");
|
ewin.SetText("Hello World");
|
||||||
// Request that the window is automatically hidden when the "close"
|
// Request that the window is automatically hidden when the "close"
|
||||||
|
@ -20,12 +20,12 @@ public class Example
|
||||||
});
|
});
|
||||||
// Window size must be explicitly set, otherwise it will be invisible
|
// Window size must be explicitly set, otherwise it will be invisible
|
||||||
// due to its lack of content.
|
// due to its lack of content.
|
||||||
win.SetSize(new eina.Size2D(360, 240));
|
win.SetSize(new Eina.Size2D(360, 240));
|
||||||
|
|
||||||
// Start the EFL main loop
|
// Start the EFL main loop
|
||||||
efl.ui.Config.Run();
|
Efl.Ui.Config.Run();
|
||||||
|
|
||||||
// Shutdown EFL
|
// Shutdown EFL
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,18 @@ using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
class TestMain
|
class TestMain
|
||||||
{
|
{
|
||||||
/* private efl.Loop loop; */
|
/* private Efl.Loop loop; */
|
||||||
|
|
||||||
public TestMain(efl.Loop loop)
|
public TestMain(Efl.Loop loop)
|
||||||
{
|
{
|
||||||
/* this.loop = loop; */
|
/* this.loop = loop; */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
efl.Loop loop = new efl.LoopConcrete();
|
Efl.Loop loop = new Efl.LoopConcrete();
|
||||||
|
|
||||||
TestMain listener = new TestMain(loop);
|
TestMain listener = new TestMain(loop);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class TestMain
|
||||||
|
|
||||||
loop.IDLE += listener.on_idle_enter; // Will trigger CALLBACK_ADD
|
loop.IDLE += listener.on_idle_enter; // Will trigger CALLBACK_ADD
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_idle_enter(object sender, EventArgs e)
|
public void on_idle_enter(object sender, EventArgs e)
|
||||||
|
|
|
@ -4,10 +4,10 @@ using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
class TestMain
|
class TestMain
|
||||||
{
|
{
|
||||||
private efl.Loop loop;
|
private Efl.Loop loop;
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
public TestMain(efl.Loop loop)
|
public TestMain(Efl.Loop loop)
|
||||||
{
|
{
|
||||||
this.loop = loop;
|
this.loop = loop;
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
|
@ -15,10 +15,10 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
efl.Loop loop = new efl.LoopConcrete();
|
Efl.Loop loop = new Efl.LoopConcrete();
|
||||||
efl.loop.Timer timer = new efl.loop.TimerConcrete(loop);
|
Efl.loop.Timer timer = new Efl.loop.TimerConcrete(loop);
|
||||||
|
|
||||||
TestMain listener = new TestMain(loop);
|
TestMain listener = new TestMain(loop);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class TestMain
|
||||||
|
|
||||||
loop.begin();
|
loop.begin();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_tick(object sender, EventArgs e)
|
public void on_tick(object sender, EventArgs e)
|
||||||
|
|
|
@ -2,7 +2,7 @@ using static System.Console;
|
||||||
|
|
||||||
class PlusTenNumberWrapper : example.NumberwrapperInherit
|
class PlusTenNumberWrapper : example.NumberwrapperInherit
|
||||||
{
|
{
|
||||||
public PlusTenNumberWrapper(efl.IObject parent = null)
|
public PlusTenNumberWrapper(Efl.Object parent = null)
|
||||||
: base(parent)
|
: base(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ public class ExampleEoInherit01
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
eina.Config.Init();
|
Eina.Config.Init();
|
||||||
efl.eo.Config.Init();
|
Efl.eo.Config.Init();
|
||||||
|
|
||||||
var inheritObj = new PlusTenNumberWrapper();
|
var inheritObj = new PlusTenNumberWrapper();
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ public class ExampleFunctionPointer01
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
eina.Config.Init();
|
Eina.Config.Init();
|
||||||
efl.eo.Config.Init();
|
Efl.eo.Config.Init();
|
||||||
|
|
||||||
var obj = new example.Numberwrapper();
|
var obj = new example.Numberwrapper();
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ public class ExampleEinaArray01
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
eina.Config.Init();
|
Eina.Config.Init();
|
||||||
|
|
||||||
var strings = new string[]{
|
var strings = new string[]{
|
||||||
"helo", "hera", "starbuck", "kat", "boomer",
|
"helo", "hera", "starbuck", "kat", "boomer",
|
||||||
|
@ -13,7 +13,7 @@ public class ExampleEinaArray01
|
||||||
"skulls", "bulldog", "flat top", "hammerhead", "gonzo"
|
"skulls", "bulldog", "flat top", "hammerhead", "gonzo"
|
||||||
};
|
};
|
||||||
|
|
||||||
var array = new eina.Array<string>(20U);
|
var array = new Eina.Array<string>(20U);
|
||||||
|
|
||||||
// Push new elements
|
// Push new elements
|
||||||
foreach (string s in strings)
|
foreach (string s in strings)
|
||||||
|
|
|
@ -4,11 +4,11 @@ public class ExampleEinaBinbuf01
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
eina.Config.Init();
|
Eina.Config.Init();
|
||||||
|
|
||||||
var bytes = new byte[]{0, 1, 2, 3, 4, 5, 6};
|
var bytes = new byte[]{0, 1, 2, 3, 4, 5, 6};
|
||||||
|
|
||||||
var bb = new eina.Binbuf();
|
var bb = new Eina.Binbuf();
|
||||||
|
|
||||||
// Append initial bytes
|
// Append initial bytes
|
||||||
bb.Append(bytes);
|
bb.Append(bytes);
|
||||||
|
|
|
@ -3,73 +3,73 @@ using static System.Console;
|
||||||
public class ExampleEinaError01
|
public class ExampleEinaError01
|
||||||
{
|
{
|
||||||
private static bool RegisteredErrors = false;
|
private static bool RegisteredErrors = false;
|
||||||
private static eina.Error MyErrorNegative;
|
private static Eina.Error MyErrorNegative;
|
||||||
private static eina.Error MyErrorNull;
|
private static Eina.Error MyErrorNull;
|
||||||
|
|
||||||
private static void testFunc(int n, string s)
|
private static void testFunc(int n, string s)
|
||||||
{
|
{
|
||||||
if (!RegisteredErrors)
|
if (!RegisteredErrors)
|
||||||
{
|
{
|
||||||
MyErrorNegative = eina.Error.Register("Negative number");
|
MyErrorNegative = Eina.Error.Register("Negative number");
|
||||||
MyErrorNull = eina.Error.Register("NULL pointer");
|
MyErrorNull = Eina.Error.Register("NULL pointer");
|
||||||
RegisteredErrors = true;
|
RegisteredErrors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
eina.Error.Set(MyErrorNegative);
|
Eina.Error.Set(MyErrorNegative);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s == null)
|
if (s == null)
|
||||||
{
|
{
|
||||||
eina.Error.Set(MyErrorNull);
|
Eina.Error.Set(MyErrorNull);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
eina.Config.Init();
|
Eina.Config.Init();
|
||||||
efl.eo.Config.Init();
|
Efl.eo.Config.Init();
|
||||||
|
|
||||||
// Handling Eina_Error with exception
|
// Handling Eina_Error with exception
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
testFunc(-1, "abc");
|
testFunc(-1, "abc");
|
||||||
eina.Error.RaiseIfOccurred();
|
Eina.Error.RaiseIfOccurred();
|
||||||
}
|
}
|
||||||
catch(efl.EflException e)
|
catch(Efl.EflException e)
|
||||||
{
|
{
|
||||||
WriteLine($"Caught error: {e.Message}");
|
WriteLine($"Caught error: {e.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handling Eina_Error directly
|
// Handling Eina_Error directly
|
||||||
testFunc(42, null);
|
testFunc(42, null);
|
||||||
eina.Error err = eina.Error.Get();
|
Eina.Error err = Eina.Error.Get();
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
WriteLine($"Error set: {err.Message}");
|
WriteLine($"Error set: {err.Message}");
|
||||||
}
|
}
|
||||||
eina.Error.Clear();
|
Eina.Error.Clear();
|
||||||
|
|
||||||
// No error set
|
// No error set
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
testFunc(42, "abc");
|
testFunc(42, "abc");
|
||||||
|
|
||||||
eina.Error.RaiseIfOccurred();
|
Eina.Error.RaiseIfOccurred();
|
||||||
|
|
||||||
err = eina.Error.Get();
|
err = Eina.Error.Get();
|
||||||
WriteLine($"Really no error? {err == eina.Error.NO_ERROR}.");
|
WriteLine($"Really no error? {err == Eina.Error.NO_ERROR}.");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
WriteLine("Unspected error!!!");
|
WriteLine("Unspected error!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLine("No error message is empty string: \"{0}\"", eina.Error.NO_ERROR.Message);
|
WriteLine("No error message is empty string: \"{0}\"", Eina.Error.NO_ERROR.Message);
|
||||||
WriteLine("No error message is empty string: \"{0}\"", eina.Error.MsgGet(0));
|
WriteLine("No error message is empty string: \"{0}\"", Eina.Error.MsgGet(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ public class ExampleEinaHash01
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
eina.Config.Init();
|
Eina.Config.Init();
|
||||||
|
|
||||||
var phone_book = new eina.Hash<string, string>();
|
var phone_book = new Eina.Hash<string, string>();
|
||||||
|
|
||||||
// Add initial entries to our hash
|
// Add initial entries to our hash
|
||||||
phone_book.Add("Wolfgang Amadeus Mozart", "+01 23 456-78910");
|
phone_book.Add("Wolfgang Amadeus Mozart", "+01 23 456-78910");
|
||||||
|
|
|
@ -2,20 +2,20 @@ using System;
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
public static efl.ui.IButton CreateButton(efl.IObject parent,
|
public static Efl.Ui.Button CreateButton(Efl.Object parent,
|
||||||
string text,
|
string text,
|
||||||
int w, int h,
|
int w, int h,
|
||||||
EventHandler callback) {
|
EventHandler callback) {
|
||||||
efl.ui.IButton button = new efl.ui.Button(parent);
|
Efl.Ui.Button button = new Efl.Ui.Button(parent);
|
||||||
button.SetText(text);
|
button.SetText(text);
|
||||||
button.SetSize(new eina.Size2D(w, h));
|
button.SetSize(new Eina.Size2D(w, h));
|
||||||
|
|
||||||
button.ClickedEvt += callback;
|
button.ClickedEvt += callback;
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Formatter(eina.Strbuf buf, eina.Value val){
|
public static void Formatter(Eina.Strbuf buf, Eina.Value val){
|
||||||
double ratio;
|
double ratio;
|
||||||
if (val.Get(out ratio)) {
|
if (val.Get(out ratio)) {
|
||||||
buf.Append($"{(int)(ratio*100)}%");
|
buf.Append($"{(int)(ratio*100)}%");
|
||||||
|
@ -34,27 +34,27 @@ public class Example
|
||||||
int W = 120;
|
int W = 120;
|
||||||
int H = 30;
|
int H = 30;
|
||||||
|
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
efl.ui.Win win = new efl.ui.Win(null);
|
Efl.Ui.Win win = new Efl.Ui.Win(null);
|
||||||
win.SetText("Hello, C#!!");
|
win.SetText("Hello, C#!!");
|
||||||
win.SetAutohide(true);
|
win.SetAutohide(true);
|
||||||
|
|
||||||
efl.ui.Box_Flow box = new efl.ui.Box_Flow(win);
|
Efl.Ui.Box_Flow box = new Efl.Ui.Box_Flow(win);
|
||||||
|
|
||||||
efl.ui.IButton button = CreateButton(box, "Click to exit", 120, 30,
|
Efl.Ui.Button button = CreateButton(box, "Click to exit", 120, 30,
|
||||||
(object sender, EventArgs e) => {
|
(object sender, EventArgs e) => {
|
||||||
efl.ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
});
|
});
|
||||||
|
|
||||||
box.DoPack(button);
|
box.DoPack(button);
|
||||||
|
|
||||||
efl.ui.Progressbar bar = new efl.ui.Progressbar(box);
|
Efl.Ui.Progressbar bar = new Efl.Ui.Progressbar(box);
|
||||||
bar.SetSize(new eina.Size2D(W, H));
|
bar.SetSize(new Eina.Size2D(W, H));
|
||||||
bar.SetFormatCb(Formatter);
|
bar.SetFormatCb(Formatter);
|
||||||
|
|
||||||
efl.ui.ISlider slider = new efl.ui.Slider(box);
|
Efl.Ui.Slider slider = new Efl.Ui.Slider(box);
|
||||||
slider.SetSize(new eina.Size2D(W, H));
|
slider.SetSize(new Eina.Size2D(W, H));
|
||||||
|
|
||||||
slider.ChangedEvt += (object sender, EventArgs e) => {
|
slider.ChangedEvt += (object sender, EventArgs e) => {
|
||||||
bar.SetRangeValue(slider.GetRangeValue());
|
bar.SetRangeValue(slider.GetRangeValue());
|
||||||
|
@ -66,12 +66,12 @@ public class Example
|
||||||
button.SetVisible(true);
|
button.SetVisible(true);
|
||||||
box.SetVisible(true);
|
box.SetVisible(true);
|
||||||
|
|
||||||
win.SetSize(new eina.Size2D(W, 3 * H));
|
win.SetSize(new Eina.Size2D(W, 3 * H));
|
||||||
win.SetVisible(true);
|
win.SetVisible(true);
|
||||||
|
|
||||||
efl.ui.Config.Run();
|
Efl.Ui.Config.Run();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,16 @@ public class Example
|
||||||
return miles * KMS_PER_MILE;
|
return miles * KMS_PER_MILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ShowErrorPopup(efl.ui.Win win, string message)
|
private static void ShowErrorPopup(Efl.Ui.Win win, string message)
|
||||||
{
|
{
|
||||||
efl.ui.IPopup_Alert popup = new efl.ui.Popup_Alert(win);
|
Efl.Ui.Popup_Alert popup = new Efl.Ui.Popup_Alert(win);
|
||||||
efl.ui.Text popup_text = new efl.ui.Text(popup);
|
Efl.Ui.Text popup_text = new Efl.Ui.Text(popup);
|
||||||
popup_text.SetText($"Error: {message}");
|
popup_text.SetText($"Error: {message}");
|
||||||
popup.SetContent(popup_text);
|
popup.SetContent(popup_text);
|
||||||
popup.SetVisible(true);
|
popup.SetVisible(true);
|
||||||
popup.SetButton(efl.ui.Popup_Alert_Button.Positive, "Ok");
|
popup.SetButton(Efl.Ui.Popup_Alert_Button.Positive, "Ok");
|
||||||
popup.SetSize(new eina.Size2D(150, 30));
|
popup.SetSize(new Eina.Size2D(150, 30));
|
||||||
popup.ButtonClickedEvt += (object sender, efl.ui.Popup_Alert.ButtonClickedEvt_Args e) => {
|
popup.ButtonClickedEvt += (object sender, Efl.Ui.Popup_Alert.ButtonClickedEvt_Args e) => {
|
||||||
popup.SetParent(null);
|
popup.SetParent(null);
|
||||||
popup.Invalidate();
|
popup.Invalidate();
|
||||||
};
|
};
|
||||||
|
@ -37,34 +37,34 @@ public class Example
|
||||||
public static void Main() {
|
public static void Main() {
|
||||||
int W = 120;
|
int W = 120;
|
||||||
int H = 30;
|
int H = 30;
|
||||||
eina.Size2D size = new eina.Size2D(W, H);
|
Eina.Size2D size = new Eina.Size2D(W, H);
|
||||||
|
|
||||||
efl.All.Init(efl.Components.Ui);
|
Efl.All.Init(Efl.Components.Ui);
|
||||||
|
|
||||||
efl.ui.Win win = new efl.ui.Win(null);
|
Efl.Ui.Win win = new Efl.Ui.Win(null);
|
||||||
win.SetText("C# Unit Converter");
|
win.SetText("C# Unit Converter");
|
||||||
win.SetAutohide(true);
|
win.SetAutohide(true);
|
||||||
|
|
||||||
efl.ui.Box_Flow box = new efl.ui.Box_Flow(win);
|
Efl.Ui.Box_Flow box = new Efl.Ui.Box_Flow(win);
|
||||||
box.SetDirection(efl.ui.Dir.Horizontal);
|
box.SetDirection(Efl.Ui.Dir.Horizontal);
|
||||||
|
|
||||||
efl.ui.Box_Flow miles_box = new efl.ui.Box_Flow(box);
|
Efl.Ui.Box_Flow miles_box = new Efl.Ui.Box_Flow(box);
|
||||||
miles_box.SetDirection(efl.ui.Dir.Down);
|
miles_box.SetDirection(Efl.Ui.Dir.Down);
|
||||||
|
|
||||||
box.DoPack(miles_box);
|
box.DoPack(miles_box);
|
||||||
|
|
||||||
efl.ui.Text miles_label = new efl.ui.Text(miles_box);
|
Efl.Ui.Text miles_label = new Efl.Ui.Text(miles_box);
|
||||||
miles_label.SetText("Miles:");
|
miles_label.SetText("Miles:");
|
||||||
miles_label.SetSize(size);
|
miles_label.SetSize(size);
|
||||||
miles_label.SetVisible(true);
|
miles_label.SetVisible(true);
|
||||||
|
|
||||||
efl.ui.Text_Editable miles_input = new efl.ui.Text_Editable(miles_box);
|
Efl.Ui.Text_Editable miles_input = new Efl.Ui.Text_Editable(miles_box);
|
||||||
miles_input.SetText("");
|
miles_input.SetText("");
|
||||||
miles_input.SetScrollable(true);
|
miles_input.SetScrollable(true);
|
||||||
miles_input.SetSize(size);
|
miles_input.SetSize(size);
|
||||||
miles_input.SetVisible(true);
|
miles_input.SetVisible(true);
|
||||||
|
|
||||||
efl.ui.IButton miles_button = new efl.ui.Button(miles_box);
|
Efl.Ui.Button miles_button = new Efl.Ui.Button(miles_box);
|
||||||
miles_button.SetText("To Km");
|
miles_button.SetText("To Km");
|
||||||
miles_button.SetSize(size);
|
miles_button.SetSize(size);
|
||||||
miles_button.SetVisible(true);
|
miles_button.SetVisible(true);
|
||||||
|
@ -74,23 +74,23 @@ public class Example
|
||||||
miles_box.DoPack(miles_button);
|
miles_box.DoPack(miles_button);
|
||||||
|
|
||||||
|
|
||||||
efl.ui.Box_Flow kms_box = new efl.ui.Box_Flow(box);
|
Efl.Ui.Box_Flow kms_box = new Efl.Ui.Box_Flow(box);
|
||||||
kms_box.SetDirection(efl.ui.Dir.Down);
|
kms_box.SetDirection(Efl.Ui.Dir.Down);
|
||||||
|
|
||||||
box.DoPack(kms_box);
|
box.DoPack(kms_box);
|
||||||
|
|
||||||
efl.ui.Text kms_label = new efl.ui.Text(kms_box);
|
Efl.Ui.Text kms_label = new Efl.Ui.Text(kms_box);
|
||||||
kms_label.SetText("Kilometers:");
|
kms_label.SetText("Kilometers:");
|
||||||
kms_label.SetSize(size);
|
kms_label.SetSize(size);
|
||||||
kms_label.SetVisible(true);
|
kms_label.SetVisible(true);
|
||||||
|
|
||||||
efl.ui.Text_Editable kms_input = new efl.ui.Text_Editable(kms_box);
|
Efl.Ui.Text_Editable kms_input = new Efl.Ui.Text_Editable(kms_box);
|
||||||
kms_input.SetText("");
|
kms_input.SetText("");
|
||||||
kms_input.SetScrollable(true);
|
kms_input.SetScrollable(true);
|
||||||
kms_input.SetSize(size);
|
kms_input.SetSize(size);
|
||||||
kms_input.SetVisible(true);
|
kms_input.SetVisible(true);
|
||||||
|
|
||||||
efl.ui.IButton kms_button = new efl.ui.Button(kms_box);
|
Efl.Ui.Button kms_button = new Efl.Ui.Button(kms_box);
|
||||||
kms_button.SetText("To Miles");
|
kms_button.SetText("To Miles");
|
||||||
kms_button.SetSize(size);
|
kms_button.SetSize(size);
|
||||||
kms_button.SetVisible(true);
|
kms_button.SetVisible(true);
|
||||||
|
@ -134,17 +134,17 @@ public class Example
|
||||||
kms_box.SetVisible(true);
|
kms_box.SetVisible(true);
|
||||||
miles_box.SetVisible(true);
|
miles_box.SetVisible(true);
|
||||||
|
|
||||||
box.SetPosition(new eina.Position2D(20, 30));
|
box.SetPosition(new Eina.Position2D(20, 30));
|
||||||
box.SetVisible(true);
|
box.SetVisible(true);
|
||||||
|
|
||||||
win.SetPosition(new eina.Position2D(200, 200));
|
win.SetPosition(new Eina.Position2D(200, 200));
|
||||||
|
|
||||||
win.SetSize(new eina.Size2D(400, 120));
|
win.SetSize(new Eina.Size2D(400, 120));
|
||||||
win.SetVisible(true);
|
win.SetVisible(true);
|
||||||
|
|
||||||
efl.ui.Config.Run();
|
Efl.Ui.Config.Run();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
public class MyBox : evas.BoxInherit
|
public class MyBox : evas.BoxInherit
|
||||||
{
|
{
|
||||||
public MyBox(efl.IObject parent) : base(parent) {}
|
public MyBox(Efl.Object parent) : base(parent) {}
|
||||||
|
|
||||||
[DllImport("evas")] static extern void evas_obj_box_layout_vertical(IntPtr obj, IntPtr data, IntPtr privdata);
|
[DllImport("evas")] static extern void evas_obj_box_layout_vertical(IntPtr obj, IntPtr data, IntPtr privdata);
|
||||||
[DllImport("evas")] static extern void evas_obj_box_layout_horizontal(IntPtr obj, IntPtr data, IntPtr privdata);
|
[DllImport("evas")] static extern void evas_obj_box_layout_horizontal(IntPtr obj, IntPtr data, IntPtr privdata);
|
||||||
|
@ -30,21 +30,21 @@ class TestMain
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
efl.Loop loop = new efl.Loop();
|
Efl.Loop loop = new Efl.Loop();
|
||||||
|
|
||||||
|
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
|
|
||||||
efl.canvas.IObject canvas = ecore_evas.canvas;
|
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
efl.IObject parent = canvas.GetParent();
|
Efl.Object parent = canvas.GetParent();
|
||||||
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
||||||
|
|
||||||
evas.IBox box = new MyBox(canvas);
|
evas.IBox box = new MyBox(canvas);
|
||||||
eina.Size2D size = new eina.Size2D();
|
Eina.Size2D size = new Eina.Size2D();
|
||||||
|
|
||||||
size.W = 320;
|
size.W = 320;
|
||||||
size.H = 240;
|
size.H = 240;
|
||||||
|
@ -52,7 +52,7 @@ class TestMain
|
||||||
box.SetSize(size);
|
box.SetSize(size);
|
||||||
box.SetVisible(true);
|
box.SetVisible(true);
|
||||||
|
|
||||||
efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
|
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
|
||||||
rect.SetColor(0, 0, 255, 255);
|
rect.SetColor(0, 0, 255, 255);
|
||||||
size.W = 320;
|
size.W = 320;
|
||||||
size.H = 120;
|
size.H = 120;
|
||||||
|
@ -60,7 +60,7 @@ class TestMain
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
box.Append(rect);
|
box.Append(rect);
|
||||||
|
|
||||||
efl.canvas.Rectangle rect2 = new efl.canvas.Rectangle(canvas);
|
Efl.Canvas.Rectangle rect2 = new Efl.Canvas.Rectangle(canvas);
|
||||||
rect2.SetColor(0, 255, 0, 255);
|
rect2.SetColor(0, 255, 0, 255);
|
||||||
rect2.SetSize(size);
|
rect2.SetSize(size);
|
||||||
rect2.SetVisible(true);
|
rect2.SetVisible(true);
|
||||||
|
@ -68,6 +68,6 @@ class TestMain
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,20 +21,20 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
efl.Loop loop = new efl.Loop();
|
Efl.Loop loop = new Efl.Loop();
|
||||||
|
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
eina.Size2D size = new eina.Size2D();
|
Eina.Size2D size = new Eina.Size2D();
|
||||||
|
|
||||||
efl.canvas.IObject canvas = ecore_evas.canvas;
|
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
efl.IObject parent = canvas.GetParent();
|
Efl.Object parent = canvas.GetParent();
|
||||||
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
||||||
|
|
||||||
efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
|
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
|
||||||
bg.SetColor(255, 255, 255, 255);
|
bg.SetColor(255, 255, 255, 255);
|
||||||
size.W = WIDTH;
|
size.W = WIDTH;
|
||||||
size.H = HEIGHT;
|
size.H = HEIGHT;
|
||||||
|
@ -47,10 +47,10 @@ class TestMain
|
||||||
|
|
||||||
/* FIXME evas-image uses error handling code from
|
/* FIXME evas-image uses error handling code from
|
||||||
* evas_object_image_load_error_get, which seems to be not available
|
* evas_object_image_load_error_get, which seems to be not available
|
||||||
* efl.image.load.State state = image.load_error_get(); */
|
* Efl.image.load.State state = image.load_error_get(); */
|
||||||
|
|
||||||
// FIXME missing move
|
// FIXME missing move
|
||||||
eina.Rect rect = new eina.Rect();
|
Eina.Rect rect = new Eina.Rect();
|
||||||
|
|
||||||
rect.X = 0;
|
rect.X = 0;
|
||||||
rect.Y = 0;
|
rect.Y = 0;
|
||||||
|
@ -76,12 +76,12 @@ class TestMain
|
||||||
|
|
||||||
/* bg.key_focus_set(true); */
|
/* bg.key_focus_set(true); */
|
||||||
/* bg.event_callback_priority_add(evas.Callback_Type.Key_down, */
|
/* bg.event_callback_priority_add(evas.Callback_Type.Key_down, */
|
||||||
/* efl.Callback_Priority.Default, */
|
/* Efl.Callback_Priority.Default, */
|
||||||
/* callback, null); */
|
/* callback, null); */
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_key_down(object sender, EventArgs e)
|
public void on_key_down(object sender, EventArgs e)
|
||||||
|
|
|
@ -10,19 +10,19 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
efl.Loop loop = new efl.Loop();
|
Efl.Loop loop = new Efl.Loop();
|
||||||
|
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
|
|
||||||
eina.Size2D size = new eina.Size2D();
|
Eina.Size2D size = new Eina.Size2D();
|
||||||
eina.Position2D pos = new eina.Position2D();
|
Eina.Position2D pos = new Eina.Position2D();
|
||||||
|
|
||||||
efl.canvas.IObject canvas = ecore_evas.canvas;
|
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
|
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
|
||||||
bg.SetColor(255, 255, 255, 255);
|
bg.SetColor(255, 255, 255, 255);
|
||||||
pos.X = 0;
|
pos.X = 0;
|
||||||
pos.Y = 0;
|
pos.Y = 0;
|
||||||
|
@ -66,7 +66,7 @@ class TestMain
|
||||||
noise_img.SetVisible(true);
|
noise_img.SetVisible(true);
|
||||||
Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH/4, HEIGHT/4);
|
Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH/4, HEIGHT/4);
|
||||||
|
|
||||||
efl.canvas.Proxy proxy_img = new efl.canvas.Proxy(canvas);
|
Efl.Canvas.Proxy proxy_img = new Efl.Canvas.Proxy(canvas);
|
||||||
proxy_img.SetSource(noise_img);
|
proxy_img.SetSource(noise_img);
|
||||||
pos.X = WIDTH / 2;
|
pos.X = WIDTH / 2;
|
||||||
pos.Y = HEIGHT / 2;
|
pos.Y = HEIGHT / 2;
|
||||||
|
|
|
@ -12,25 +12,25 @@ class TestMain
|
||||||
{
|
{
|
||||||
int color_index = 0;
|
int color_index = 0;
|
||||||
|
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
efl.Loop loop = new efl.Loop();
|
Efl.Loop loop = new Efl.Loop();
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
efl.canvas.IObject canvas = ecore_evas.canvas;
|
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
efl.IObject parent = canvas.GetParent();
|
Efl.Object parent = canvas.GetParent();
|
||||||
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
||||||
|
|
||||||
efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
|
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
|
||||||
rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255);
|
rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255);
|
||||||
eina.Size2D size = new eina.Size2D();
|
Eina.Size2D size = new Eina.Size2D();
|
||||||
size.W = 640;
|
size.W = 640;
|
||||||
size.H = 480;
|
size.H = 480;
|
||||||
rect.SetSize(size);
|
rect.SetSize(size);
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
|
|
||||||
canvas.KeyDownEvt += (object sender, efl.input.Interface.KeyDownEvt_Args e) => {
|
canvas.KeyDownEvt += (object sender, Efl.Input.Interface.KeyDownEvt_Args e) => {
|
||||||
color_index = (color_index + 1) % 3;
|
color_index = (color_index + 1) % 3;
|
||||||
Console.WriteLine("Key Down");
|
Console.WriteLine("Key Down");
|
||||||
Console.WriteLine("Got key obj at {0}", e.arg.raw_handle.ToString("X"));
|
Console.WriteLine("Got key obj at {0}", e.arg.raw_handle.ToString("X"));
|
||||||
|
@ -42,6 +42,6 @@ class TestMain
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,25 +9,25 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
efl.Loop loop = new efl.Loop();
|
Efl.Loop loop = new Efl.Loop();
|
||||||
|
|
||||||
EcoreEvas ecore_evas = new EcoreEvas();
|
EcoreEvas ecore_evas = new EcoreEvas();
|
||||||
|
|
||||||
eina.Size2D size = new eina.Size2D();
|
Eina.Size2D size = new Eina.Size2D();
|
||||||
size.W = WIDTH;
|
size.W = WIDTH;
|
||||||
size.H = HEIGHT;
|
size.H = HEIGHT;
|
||||||
|
|
||||||
eina.Size2D hint = new eina.Size2D();
|
Eina.Size2D hint = new Eina.Size2D();
|
||||||
|
|
||||||
efl.canvas.IObject canvas = ecore_evas.canvas;
|
Efl.Canvas.Object canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
efl.IObject parent = canvas.GetParent();
|
Efl.Object parent = canvas.GetParent();
|
||||||
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);
|
||||||
|
|
||||||
efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
|
Efl.Canvas.Rectangle bg = new Efl.Canvas.Rectangle(canvas);
|
||||||
bg.SetColor(255, 255, 255, 255);
|
bg.SetColor(255, 255, 255, 255);
|
||||||
bg.SetSize(size);
|
bg.SetSize(size);
|
||||||
bg.SetVisible(true);
|
bg.SetVisible(true);
|
||||||
|
@ -39,7 +39,7 @@ class TestMain
|
||||||
table.SetSize(size);
|
table.SetSize(size);
|
||||||
table.SetVisible(true);
|
table.SetVisible(true);
|
||||||
|
|
||||||
efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
|
Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
|
||||||
rect.SetColor(255, 0, 0, 255);
|
rect.SetColor(255, 0, 0, 255);
|
||||||
hint.W = 100;
|
hint.W = 100;
|
||||||
hint.H = 50;
|
hint.H = 50;
|
||||||
|
@ -47,7 +47,7 @@ class TestMain
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
table.Pack(rect, 1, 1, 2, 1);
|
table.Pack(rect, 1, 1, 2, 1);
|
||||||
|
|
||||||
rect = new efl.canvas.Rectangle(canvas);
|
rect = new Efl.Canvas.Rectangle(canvas);
|
||||||
rect.SetColor(0, 255, 0, 255);
|
rect.SetColor(0, 255, 0, 255);
|
||||||
hint.W = 50;
|
hint.W = 50;
|
||||||
hint.H = 100;
|
hint.H = 100;
|
||||||
|
@ -55,7 +55,7 @@ class TestMain
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
table.Pack(rect, 1, 2, 1, 2);
|
table.Pack(rect, 1, 2, 1, 2);
|
||||||
|
|
||||||
rect = new efl.canvas.Rectangle(canvas);
|
rect = new Efl.Canvas.Rectangle(canvas);
|
||||||
rect.SetColor(0, 0, 255, 255);
|
rect.SetColor(0, 0, 255, 255);
|
||||||
hint.W = 50;
|
hint.W = 50;
|
||||||
hint.H = 50;
|
hint.H = 50;
|
||||||
|
@ -63,7 +63,7 @@ class TestMain
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
table.Pack(rect, 2, 2, 1, 1);
|
table.Pack(rect, 2, 2, 1, 1);
|
||||||
|
|
||||||
rect = new efl.canvas.Rectangle(canvas);
|
rect = new Efl.Canvas.Rectangle(canvas);
|
||||||
rect.SetColor(255, 255, 0, 255);
|
rect.SetColor(255, 255, 0, 255);
|
||||||
rect.SetHintMin(hint);
|
rect.SetHintMin(hint);
|
||||||
rect.SetVisible(true);
|
rect.SetVisible(true);
|
||||||
|
@ -71,7 +71,7 @@ class TestMain
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,19 +22,19 @@ class TestMain
|
||||||
static int HEIGHT = 240;
|
static int HEIGHT = 240;
|
||||||
|
|
||||||
private EcoreEvas ecore_evas;
|
private EcoreEvas ecore_evas;
|
||||||
private efl.canvas.IObject canvas;
|
private Efl.Canvas.Object canvas;
|
||||||
private efl.canvas.IRectangle bg;
|
private Efl.Canvas.Rectangle bg;
|
||||||
private evas.Text text;
|
private evas.Text text;
|
||||||
private evas.Image border;
|
private evas.Image border;
|
||||||
|
|
||||||
public TestMain(String border_file) {
|
public TestMain(String border_file) {
|
||||||
ecore_evas = new EcoreEvas();
|
ecore_evas = new EcoreEvas();
|
||||||
eina.Size2D size = new eina.Size2D();
|
Eina.Size2D size = new Eina.Size2D();
|
||||||
eina.Position2D position = new eina.Position2D();
|
Eina.Position2D position = new Eina.Position2D();
|
||||||
canvas = ecore_evas.canvas;
|
canvas = ecore_evas.canvas;
|
||||||
canvas.SetVisible(true);
|
canvas.SetVisible(true);
|
||||||
|
|
||||||
bg = new efl.canvas.Rectangle(canvas);
|
bg = new Efl.Canvas.Rectangle(canvas);
|
||||||
bg.SetColor(255, 255, 255, 255);
|
bg.SetColor(255, 255, 255, 255);
|
||||||
position.X = 0;
|
position.X = 0;
|
||||||
position.Y = 0;
|
position.Y = 0;
|
||||||
|
@ -65,7 +65,7 @@ class TestMain
|
||||||
text.SetPosition(position);
|
text.SetPosition(position);
|
||||||
text.SetVisible(true);
|
text.SetVisible(true);
|
||||||
|
|
||||||
efl.font.Size font_size = 0;
|
Efl.font.Size font_size = 0;
|
||||||
String font = String.Empty;
|
String font = String.Empty;
|
||||||
text.GetFont(out font, out font_size);
|
text.GetFont(out font, out font_size);
|
||||||
Console.WriteLine("Adding text object with font {0} and size {1}", font, size);
|
Console.WriteLine("Adding text object with font {0} and size {1}", font, size);
|
||||||
|
@ -87,7 +87,7 @@ class TestMain
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void On_KeyDown(object sender, efl.input.Interface.KeyDownEvt_Args e)
|
private void On_KeyDown(object sender, Efl.Input.Interface.KeyDownEvt_Args e)
|
||||||
{
|
{
|
||||||
var key = e.arg.GetKey();
|
var key = e.arg.GetKey();
|
||||||
|
|
||||||
|
@ -107,19 +107,19 @@ class TestMain
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
efl.All.Init();
|
Efl.All.Init();
|
||||||
|
|
||||||
String border_path = "./src/examples/evas/resources/images/red.png";
|
String border_path = "./src/examples/evas/resources/images/red.png";
|
||||||
|
|
||||||
if (args.Length >= 1)
|
if (args.Length >= 1)
|
||||||
border_path = args[0];
|
border_path = args[0];
|
||||||
|
|
||||||
efl.Loop loop = new efl.Loop();
|
Efl.Loop loop = new Efl.Loop();
|
||||||
TestMain t = new TestMain(border_path);
|
TestMain t = new TestMain(border_path);
|
||||||
|
|
||||||
loop.Begin();
|
loop.Begin();
|
||||||
|
|
||||||
efl.All.Shutdown();
|
Efl.All.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue