tutorials: Fix C# UI reference guides

Summary: These guides needed to be adapted to the new C# API.

Test Plan:
Didn't build before, and now it can be built and run. It has some runtime
errors on exit.

Reviewers: felipealmeida, lauromoura, Hermet

Reviewed By: Hermet

Tags: #examples

Differential Revision: https://phab.enlightenment.org/D6575
This commit is contained in:
Xavi Artigas 2018-07-13 10:14:04 -03:00 committed by Lauro Moura
parent 62ca316375
commit f1a5d614f8
2 changed files with 30 additions and 30 deletions

View File

@ -16,23 +16,23 @@ public class Example
}
// Load a simple table layout into the window
static efl.ui.Table SetupUiTable(efl.ui.Win win)
static efl.ui.ITable SetupUiTable(efl.ui.IWin win)
{
efl.ui.Table table = new efl.ui.TableConcrete(win);
efl.ui.ITable table = new efl.ui.Table(win);
table.SetTableColumns(2);
table.SetTableDirection(efl.ui.Dir.Right, efl.ui.Dir.Down);
efl.ui.Button button = new efl.ui.ButtonConcrete(win);
efl.ui.IButton button = new efl.ui.Button(win);
button.SetText("Long Button");
table.PackTable(button, 0, 2, 2, 1);
for (int i = 1; i <= 4; ++i)
{
efl.ui.Button btn = new efl.ui.ButtonConcrete(win);
efl.ui.IButton btn = new efl.ui.Button(win);
btn.SetText($"Table {i}");
table.Pack(btn);
table.DoPack(btn);
}
return table;
@ -40,14 +40,14 @@ public class Example
// Load some boxes - a horizontal one for the window layout and a vertical
// one to contain a flow
static efl.ui.Box SetupUiBoxes(efl.ui.Win win)
static efl.ui.IBox SetupUiBoxes(efl.ui.IWin win)
{
efl.ui.Box box = new efl.ui.BoxConcrete(win);
efl.ui.IBox box = new efl.ui.Box(win);
box.SetPackPadding(5, 0, true);
for (int i = 1; i <= 4; ++i)
{
efl.ui.Button button = new efl.ui.ButtonConcrete(win);
efl.ui.IButton button = new efl.ui.Button(win);
button.SetText($"Boxed {i}");
if (i == 2)
{
@ -56,7 +56,7 @@ public class Example
sz.H = 50;
button.SetHintMax(sz);
}
box.Pack(button);
box.DoPack(button);
}
return box;
@ -66,8 +66,8 @@ public class Example
{
efl.All.Init(efl.Components.Ui);
efl.ui.Win win = new efl.ui.WinConcrete(null, (efl.ui.Win ewin) => {
ewin.SetWinType(efl.ui.win.Type.Basic);
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
ewin.SetWinType(efl.ui.Win_Type.Basic);
ewin.SetText("Hello World");
ewin.SetAutohide(true);
});
@ -77,32 +77,32 @@ public class Example
win.SetSize(sz);
// when the user clicks "close" on a window there is a request to hide
win.HIDE += GuiQuitCb;
win.HideEvt += GuiQuitCb;
// Load a vertical and horizontal split into the window
efl.ui.Panes split = new efl.ui.PanesConcrete(win);
efl.ui.IPanes split = new efl.ui.Panes(win);
split.SetSplitRatio(0.75);
win.SetContent(split);
var boxes = SetupUiBoxes(win);
efl.ContentConcrete.static_cast(split.Part("first")).SetContent(boxes);
efl.Content.static_cast(split.GetPart("first")).SetContent(boxes);
efl.ui.Panes horiz_split = new efl.ui.PanesConcrete(win);
efl.ui.IPanes horiz_split = new efl.ui.Panes(win);
horiz_split.SetDirection(efl.ui.Dir.Horizontal);
horiz_split.SetSplitRatio(0.85);
efl.ContentConcrete.static_cast(split.Part("second")).SetContent(horiz_split);
efl.Content.static_cast(split.GetPart("second")).SetContent(horiz_split);
var table = SetupUiTable(win);
efl.ContentConcrete.static_cast(horiz_split.Part("first")).SetContent(table);
efl.Content.static_cast(horiz_split.GetPart("first")).SetContent(table);
efl.ui.Button quit_btn = new efl.ui.ButtonConcrete(win);
efl.ui.IButton quit_btn = new efl.ui.Button(win);
quit_btn.SetText("Quit");
sz.W = 150;
sz.H = 30;
quit_btn.SetHintMax(sz);
quit_btn.CLICKED += GuiQuitCb;
efl.ContentConcrete.static_cast(horiz_split.Part("second")).SetContent(quit_btn);
quit_btn.ClickedEvt += GuiQuitCb;
efl.Content.static_cast(horiz_split.GetPart("second")).SetContent(quit_btn);
// Start event loop
efl.ui.Config.Run();

View File

@ -14,8 +14,8 @@ public class Example
{
efl.All.Init(efl.Components.Ui);
efl.ui.Win win = new efl.ui.WinConcrete(null, (efl.ui.Win ewin) => {
ewin.SetWinType(efl.ui.win.Type.Basic);
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
ewin.SetWinType(efl.ui.Win_Type.Basic);
ewin.SetText("Size Control");
ewin.SetAutohide(true);
});
@ -25,31 +25,31 @@ public class Example
win.SetSize(sz);
// when the user clicks "close" on a window there is a request to hide
win.HIDE += (object sender, EventArgs e) => {
win.HideEvt += (object sender, EventArgs e) => {
// quit the app, called if the window is hidden
efl.ui.Config.Exit();
};
efl.ui.Box box = new efl.ui.BoxConcrete(win);
efl.ui.IBox box = new efl.ui.Box(win);
win.SetContent(box);
efl.ui.Button button = new efl.ui.ButtonConcrete(win);
efl.ui.IButton button = new efl.ui.Button(win);
button.SetText("Button");
box.Pack(button);
box.DoPack(button);
efl.ui.Button small_btn = new efl.ui.ButtonConcrete(win);
efl.ui.IButton small_btn = new efl.ui.Button(win);
small_btn.SetText("Small");
sz.W = 50;
sz.H = 50;
small_btn.SetHintMax(sz);
box.Pack(small_btn);
box.DoPack(small_btn);
efl.ui.Button big_btn = new efl.ui.ButtonConcrete(win);
efl.ui.IButton big_btn = new efl.ui.Button(win);
big_btn.SetText("Big Button");
sz.W = 100;
sz.H = 100;
big_btn.SetHintMin(sz);
box.Pack(big_btn);
box.DoPack(big_btn);
efl.ui.Config.Run();