2018-02-09 13:07:12 -08:00
|
|
|
/*
|
|
|
|
* Efl.UI sizing examples.
|
|
|
|
*
|
|
|
|
* Demonstrate how to use the sizing api from Efl.Gfx.
|
2018-09-17 10:18:06 -07:00
|
|
|
* We load a box with 3 buttons, one with default sizing, one that has a max size
|
|
|
|
* and the last one has a min size. Try resizing the window to see how this changes.
|
2018-02-09 13:07:12 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
2019-03-26 04:19:13 -07:00
|
|
|
public class Example : Efl.Csharp.Application
|
2018-02-09 13:07:12 -08:00
|
|
|
{
|
2019-06-28 15:46:12 -07:00
|
|
|
protected override void OnInitialize(string[] args)
|
2018-02-09 13:07:12 -08:00
|
|
|
{
|
2018-09-17 10:18:06 -07:00
|
|
|
// Create a window and initialize it
|
2019-04-04 04:17:30 -07:00
|
|
|
Efl.Ui.Win win = new Efl.Ui.Win(null, winType: Efl.Ui.WinType.Basic);
|
2020-02-20 08:09:22 -08:00
|
|
|
win.Text = "Size Control";
|
|
|
|
win.Autohide = true;
|
2019-09-06 07:10:16 -07:00
|
|
|
win.VisibilityChangedEvent += (object sender, Efl.Gfx.EntityVisibilityChangedEventArgs e) => {
|
2019-01-18 07:53:55 -08:00
|
|
|
// Exit the EFL main loop
|
2020-02-07 00:49:57 -08:00
|
|
|
if (e.Arg == false)
|
2019-03-04 09:17:36 -08:00
|
|
|
Efl.Ui.Config.Exit();
|
2019-01-18 07:53:55 -08:00
|
|
|
};
|
2018-02-09 13:07:12 -08:00
|
|
|
|
2018-09-17 10:18:06 -07:00
|
|
|
// Create a box container
|
2019-01-18 07:53:55 -08:00
|
|
|
Efl.Ui.Box box = new Efl.Ui.Box(win);
|
|
|
|
win.SetContent(box);
|
2018-09-17 10:18:06 -07:00
|
|
|
|
|
|
|
// Create a regular button (without size hints)
|
2019-01-18 07:53:55 -08:00
|
|
|
var button = new Efl.Ui.Button(win);
|
2020-02-20 08:09:22 -08:00
|
|
|
button.Text = "Button";
|
2019-04-23 03:32:06 -07:00
|
|
|
box.Pack(button);
|
2018-09-17 10:18:06 -07:00
|
|
|
|
|
|
|
// Create a small button (max size is limited)
|
2019-01-18 07:53:55 -08:00
|
|
|
button = new Efl.Ui.Button(win);
|
2020-02-20 08:09:22 -08:00
|
|
|
button.Text = "Small";
|
|
|
|
button.HintSizeMax = new Eina.Size2D(50,50);
|
2019-04-23 03:32:06 -07:00
|
|
|
box.Pack(button);
|
2018-09-17 10:18:06 -07:00
|
|
|
|
|
|
|
// Create a big button (min size is limited)
|
2019-01-18 07:53:55 -08:00
|
|
|
button = new Efl.Ui.Button(win);
|
2020-02-20 08:09:22 -08:00
|
|
|
button.Text = "Big button";
|
|
|
|
button.HintSizeMin = new Eina.Size2D(100,100);
|
2019-04-23 03:32:06 -07:00
|
|
|
box.Pack(button);
|
2019-03-26 04:19:13 -07:00
|
|
|
}
|
2018-09-17 10:18:06 -07:00
|
|
|
|
2019-03-26 04:19:13 -07:00
|
|
|
#if WIN32
|
|
|
|
[STAThreadAttribute()]
|
|
|
|
#endif
|
|
|
|
public static void Main()
|
|
|
|
{
|
|
|
|
var example = new Example();
|
|
|
|
example.Launch();
|
2018-02-09 13:07:12 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|