csharp: Fix gui_main.cs compilation.
Summary: - Removed the Concrete suffixes - Changed interfaces to IFoobar - Event names are now camelcase with 'Evt' suffix - Methods with the same name as its class are prefixed with 'Do' due to C# CamelCase methods (Pack.Pack -> Pack.DoPack) - Updated efl.ui.win.Type to efl.ui.Win_Type after API renaming Reviewers: segfaultxavi, felipealmeida Reviewed By: segfaultxavi Differential Revision: https://phab.enlightenment.org/D6508
This commit is contained in:
parent
15aa26eb16
commit
62ca316375
|
@ -15,52 +15,51 @@ 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.Text)sender).GetText()} changed to {((efl.ui.Widget)sender).GetFocus()}");
|
Console.WriteLine($"Focus for object {((efl.IText)sender).GetText()} changed to {((efl.ui.IWidget)sender).GetFocus()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
efl.All.Init(efl.Components.Ui);
|
efl.All.Init(efl.Components.Ui);
|
||||||
|
|
||||||
efl.ui.Win win = new efl.ui.WinConcrete(null, (efl.ui.Win ewin) => {
|
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
|
||||||
ewin.SetWinType(efl.ui.win.Type.Basic);
|
ewin.SetWinType(efl.ui.Win_Type.Basic);
|
||||||
ewin.SetText("Hello World");
|
ewin.SetText("Hello World");
|
||||||
ewin.SetAutohide(true);
|
ewin.SetAutohide(true);
|
||||||
});
|
});
|
||||||
win.HIDE += QuitCb;
|
win.HideEvt += QuitCb;
|
||||||
|
|
||||||
efl.ui.Box box = new efl.ui.BoxConcrete(win);
|
efl.ui.IBox box = new efl.ui.Box(win);
|
||||||
eina.Size2D sz;
|
eina.Size2D sz;
|
||||||
sz.W = 360;
|
sz.W = 360;
|
||||||
sz.H = 240;
|
sz.H = 240;
|
||||||
box.SetHintMin(sz);
|
box.SetHintMin(sz);
|
||||||
win.SetContent(box);
|
win.SetContent(box);
|
||||||
|
|
||||||
efl.ui.Text text = new efl.ui.TextConcrete(box);
|
efl.ui.IText text = new efl.ui.Text(box);
|
||||||
text.SetText("Label");
|
text.SetText("Label");
|
||||||
text.SetEditable(false);
|
text.SetEditable(false);
|
||||||
text.FOCUS_CHANGED += FocusChangedCb;
|
text.FocusChangedEvt += FocusChangedCb;
|
||||||
box.Pack(text);
|
box.DoPack(text);
|
||||||
|
|
||||||
efl.ui.Box hbox = new efl.ui.BoxConcrete(box);
|
efl.ui.IBox hbox = new efl.ui.Box(box);
|
||||||
hbox.SetDirection(efl.ui.Dir.Horizontal);
|
hbox.SetDirection(efl.ui.Dir.Horizontal);
|
||||||
hbox.SetHintWeight(1.0, 0.1);
|
hbox.SetHintWeight(1.0, 0.1);
|
||||||
box.Pack(hbox);
|
box.DoPack(hbox);
|
||||||
|
|
||||||
efl.ui.Button about = new efl.ui.ButtonConcrete(hbox);
|
efl.ui.IButton about = new efl.ui.Button(hbox);
|
||||||
about.SetText("About");
|
about.SetText("About");
|
||||||
about.FOCUS_CHANGED += FocusChangedCb;
|
about.FocusChangedEvt += FocusChangedCb;
|
||||||
about.CLICKED += AboutCb;
|
about.ClickedEvt += AboutCb;
|
||||||
hbox.Pack(about);
|
hbox.DoPack(about);
|
||||||
|
|
||||||
efl.ui.Button quit = new efl.ui.ButtonConcrete(hbox);
|
efl.ui.IButton quit = new efl.ui.Button(hbox);
|
||||||
quit.SetText("Quit");
|
quit.SetText("Quit");
|
||||||
quit.FOCUS_CHANGED += FocusChangedCb;
|
quit.FocusChangedEvt += FocusChangedCb;
|
||||||
quit.CLICKED += QuitCb;
|
quit.ClickedEvt += QuitCb;
|
||||||
hbox.Pack(quit);
|
hbox.DoPack(quit);
|
||||||
|
|
||||||
// TODO: Create public references to classes
|
efl.ui.focus.Util.Focus(about);
|
||||||
// efl_ui_focus_util_focus(EFL_UI_FOCUS_UTIL_CLASS, about);
|
|
||||||
|
|
||||||
efl.ui.Config.Run();
|
efl.ui.Config.Run();
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,16 @@ public class Example
|
||||||
{
|
{
|
||||||
efl.All.Init(efl.Components.Ui);
|
efl.All.Init(efl.Components.Ui);
|
||||||
|
|
||||||
efl.ui.Win win = new efl.ui.WinConcrete(null, (efl.ui.Win ewin) => {
|
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
|
||||||
ewin.SetWinType(efl.ui.win.Type.Basic);
|
ewin.SetWinType(efl.ui.Win_Type.Basic);
|
||||||
ewin.SetText("Hello World");
|
ewin.SetText("Hello World");
|
||||||
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.HIDE += QuitCb;
|
win.HideEvt += QuitCb;
|
||||||
|
|
||||||
efl.ui.Box box = new efl.ui.BoxConcrete(win);
|
efl.ui.IBox box = new efl.ui.Box(win);
|
||||||
eina.Size2D sz;
|
eina.Size2D sz;
|
||||||
sz.W = 360;
|
sz.W = 360;
|
||||||
sz.H = 240;
|
sz.H = 240;
|
||||||
|
@ -28,22 +28,22 @@ public class Example
|
||||||
|
|
||||||
win.SetContent(box);
|
win.SetContent(box);
|
||||||
|
|
||||||
efl.ui.Text text = new efl.ui.TextConcrete(box);
|
efl.ui.IText text = new efl.ui.Text(box);
|
||||||
// text.SetMarkup("Hello World.<br>This is an <b>Efl.Ui</b> application!"); // TODO: Correct .eo inheritance
|
// text.SetMarkup("Hello World.<br>This is an <b>Efl.Ui</b> application!"); // TODO: Correct .eo inheritance
|
||||||
text.SetText("Hello World. This is an Efl.Ui application!");
|
text.SetText("Hello World. This is an Efl.Ui application!");
|
||||||
text.SetSelectionAllowed(false);
|
text.SetSelectionAllowed(false);
|
||||||
text.SetHintWeight(1.0, 0.9);
|
text.SetHintWeight(1.0, 0.9);
|
||||||
text.SetHintAlign(0.5, 0.5);
|
text.SetHintAlign(0.5, 0.5);
|
||||||
|
|
||||||
box.Pack(text);
|
box.DoPack(text);
|
||||||
|
|
||||||
efl.ui.Button button = new efl.ui.ButtonConcrete(box);
|
efl.ui.IButton button = new efl.ui.Button(box);
|
||||||
button.SetText("Quit");
|
button.SetText("Quit");
|
||||||
button.SetHintWeight(1.0, 0.1);
|
button.SetHintWeight(1.0, 0.1);
|
||||||
|
|
||||||
button.CLICKED += QuitCb;
|
button.ClickedEvt += QuitCb;
|
||||||
|
|
||||||
box.Pack(button);
|
box.DoPack(button);
|
||||||
|
|
||||||
efl.ui.Config.Run();
|
efl.ui.Config.Run();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue