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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
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);
|
||||
});
|
||||
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;
|
||||
sz.W = 360;
|
||||
sz.H = 240;
|
||||
box.SetHintMin(sz);
|
||||
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.SetEditable(false);
|
||||
text.FOCUS_CHANGED += FocusChangedCb;
|
||||
box.Pack(text);
|
||||
text.FocusChangedEvt += FocusChangedCb;
|
||||
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.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.FOCUS_CHANGED += FocusChangedCb;
|
||||
about.CLICKED += AboutCb;
|
||||
hbox.Pack(about);
|
||||
about.FocusChangedEvt += FocusChangedCb;
|
||||
about.ClickedEvt += AboutCb;
|
||||
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.FOCUS_CHANGED += FocusChangedCb;
|
||||
quit.CLICKED += QuitCb;
|
||||
hbox.Pack(quit);
|
||||
quit.FocusChangedEvt += FocusChangedCb;
|
||||
quit.ClickedEvt += QuitCb;
|
||||
hbox.DoPack(quit);
|
||||
|
||||
// TODO: Create public references to classes
|
||||
// efl_ui_focus_util_focus(EFL_UI_FOCUS_UTIL_CLASS, about);
|
||||
efl.ui.focus.Util.Focus(about);
|
||||
|
||||
efl.ui.Config.Run();
|
||||
|
||||
|
|
|
@ -11,16 +11,16 @@ 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);
|
||||
});
|
||||
|
||||
// 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;
|
||||
sz.W = 360;
|
||||
sz.H = 240;
|
||||
|
@ -28,22 +28,22 @@ public class Example
|
|||
|
||||
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.SetText("Hello World. This is an Efl.Ui application!");
|
||||
text.SetSelectionAllowed(false);
|
||||
text.SetHintWeight(1.0, 0.9);
|
||||
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.SetHintWeight(1.0, 0.1);
|
||||
|
||||
button.CLICKED += QuitCb;
|
||||
button.ClickedEvt += QuitCb;
|
||||
|
||||
box.Pack(button);
|
||||
box.DoPack(button);
|
||||
|
||||
efl.ui.Config.Run();
|
||||
|
||||
|
|
Loading…
Reference in New Issue