71 lines
1.9 KiB
C#
71 lines
1.9 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.Text)sender).GetText()} changed to {((efl.ui.Widget)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);
|
||
|
ewin.SetText("Hello World");
|
||
|
ewin.SetAutohide(true);
|
||
|
});
|
||
|
win.HIDE += QuitCb;
|
||
|
|
||
|
efl.ui.Box box = new efl.ui.BoxConcrete(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);
|
||
|
text.SetText("Label");
|
||
|
text.SetEditable(false);
|
||
|
text.FOCUS_CHANGED += FocusChangedCb;
|
||
|
box.Pack(text);
|
||
|
|
||
|
efl.ui.Box hbox = new efl.ui.BoxConcrete(box);
|
||
|
hbox.SetDirection(efl.ui.Dir.Horizontal);
|
||
|
hbox.SetHintWeight(1.0, 0.1);
|
||
|
box.Pack(hbox);
|
||
|
|
||
|
efl.ui.Button about = new efl.ui.ButtonConcrete(hbox);
|
||
|
about.SetText("About");
|
||
|
about.FOCUS_CHANGED += FocusChangedCb;
|
||
|
about.CLICKED += AboutCb;
|
||
|
hbox.Pack(about);
|
||
|
|
||
|
efl.ui.Button quit = new efl.ui.ButtonConcrete(hbox);
|
||
|
quit.SetText("Quit");
|
||
|
quit.FOCUS_CHANGED += FocusChangedCb;
|
||
|
quit.CLICKED += QuitCb;
|
||
|
hbox.Pack(quit);
|
||
|
|
||
|
// TODO: Create public references to classes
|
||
|
// efl_ui_focus_util_focus(EFL_UI_FOCUS_UTIL_CLASS, about);
|
||
|
|
||
|
efl.ui.Config.Run();
|
||
|
|
||
|
efl.All.Shutdown();
|
||
|
}
|
||
|
}
|
||
|
|