2018-02-09 13:07:12 -08:00
|
|
|
/*
|
|
|
|
* Efl.UI sizing examples.
|
|
|
|
*
|
|
|
|
* Demonstrate how to use the sizing api from Efl.Gfx.
|
|
|
|
* We load a box with 3 buttons, one with default sizing, one that has a max
|
|
|
|
* and the last has a min size. Try resizing the window to see how this changes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
public class Example
|
|
|
|
{
|
|
|
|
public static void Main()
|
|
|
|
{
|
|
|
|
efl.All.Init(efl.Components.Ui);
|
|
|
|
|
2018-07-13 06:14:04 -07:00
|
|
|
efl.ui.IWin win = new efl.ui.Win(null, (efl.ui.IWin ewin) => {
|
|
|
|
ewin.SetWinType(efl.ui.Win_Type.Basic);
|
2018-02-09 13:07:12 -08:00
|
|
|
ewin.SetText("Size Control");
|
|
|
|
ewin.SetAutohide(true);
|
|
|
|
});
|
|
|
|
eina.Size2D sz;
|
|
|
|
sz.W = 320;
|
|
|
|
sz.H = 320;
|
|
|
|
win.SetSize(sz);
|
|
|
|
|
|
|
|
// when the user clicks "close" on a window there is a request to hide
|
2018-07-13 06:14:04 -07:00
|
|
|
win.HideEvt += (object sender, EventArgs e) => {
|
2018-02-09 13:07:12 -08:00
|
|
|
// quit the app, called if the window is hidden
|
|
|
|
efl.ui.Config.Exit();
|
|
|
|
};
|
|
|
|
|
2018-07-13 06:14:04 -07:00
|
|
|
efl.ui.IBox box = new efl.ui.Box(win);
|
2018-02-09 13:07:12 -08:00
|
|
|
win.SetContent(box);
|
|
|
|
|
2018-07-13 06:14:04 -07:00
|
|
|
efl.ui.IButton button = new efl.ui.Button(win);
|
2018-02-09 13:07:12 -08:00
|
|
|
button.SetText("Button");
|
2018-07-13 06:14:04 -07:00
|
|
|
box.DoPack(button);
|
2018-02-09 13:07:12 -08:00
|
|
|
|
2018-07-13 06:14:04 -07:00
|
|
|
efl.ui.IButton small_btn = new efl.ui.Button(win);
|
2018-02-09 13:07:12 -08:00
|
|
|
small_btn.SetText("Small");
|
|
|
|
sz.W = 50;
|
|
|
|
sz.H = 50;
|
|
|
|
small_btn.SetHintMax(sz);
|
2018-07-13 06:14:04 -07:00
|
|
|
box.DoPack(small_btn);
|
2018-02-09 13:07:12 -08:00
|
|
|
|
2018-07-13 06:14:04 -07:00
|
|
|
efl.ui.IButton big_btn = new efl.ui.Button(win);
|
2018-02-09 13:07:12 -08:00
|
|
|
big_btn.SetText("Big Button");
|
|
|
|
sz.W = 100;
|
|
|
|
sz.H = 100;
|
|
|
|
big_btn.SetHintMin(sz);
|
2018-07-13 06:14:04 -07:00
|
|
|
box.DoPack(big_btn);
|
2018-02-09 13:07:12 -08:00
|
|
|
|
|
|
|
efl.ui.Config.Run();
|
|
|
|
|
|
|
|
efl.All.Shutdown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|