70 lines
1.8 KiB
C#
70 lines
1.8 KiB
C#
using System;
|
|
|
|
public class Example
|
|
{
|
|
public static void QuitCb(object sender, EventArgs e)
|
|
{
|
|
Console.WriteLine("Clicked Quit");
|
|
efl.ui.Config.Exit();
|
|
}
|
|
|
|
public static void AboutCb(object sender, EventArgs e)
|
|
{
|
|
Console.WriteLine("Clicked About");
|
|
}
|
|
|
|
public static void FocusChangedCb(object sender, EventArgs e)
|
|
{
|
|
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.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.HideEvt += QuitCb;
|
|
|
|
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.IText text = new efl.ui.Text(box);
|
|
text.SetText("Label");
|
|
text.SetEditable(false);
|
|
text.FocusChangedEvt += FocusChangedCb;
|
|
box.DoPack(text);
|
|
|
|
efl.ui.IBox hbox = new efl.ui.Box(box);
|
|
hbox.SetDirection(efl.ui.Dir.Horizontal);
|
|
hbox.SetHintWeight(1.0, 0.1);
|
|
box.DoPack(hbox);
|
|
|
|
efl.ui.IButton about = new efl.ui.Button(hbox);
|
|
about.SetText("About");
|
|
about.FocusChangedEvt += FocusChangedCb;
|
|
about.ClickedEvt += AboutCb;
|
|
hbox.DoPack(about);
|
|
|
|
efl.ui.IButton quit = new efl.ui.Button(hbox);
|
|
quit.SetText("Quit");
|
|
quit.FocusChangedEvt += FocusChangedCb;
|
|
quit.ClickedEvt += QuitCb;
|
|
hbox.DoPack(quit);
|
|
|
|
efl.ui.focus.Util.Focus(about);
|
|
|
|
efl.ui.Config.Run();
|
|
|
|
efl.All.Shutdown();
|
|
}
|
|
}
|
|
|