mono examples: Update to latest Efl.Ui.Clickable syntax
This commit is contained in:
parent
05d9b74e19
commit
836a9edf73
|
@ -72,7 +72,7 @@ public class TextEditor : Efl.Csharp.Application
|
||||||
|
|
||||||
// Adds a button to the toolbar, with the given text, icon and click event handler
|
// Adds a button to the toolbar, with the given text, icon and click event handler
|
||||||
private Efl.Ui.Button GUIToolbarButtonAdd(Efl.Ui.Box toolbar, string name,
|
private Efl.Ui.Button GUIToolbarButtonAdd(Efl.Ui.Box toolbar, string name,
|
||||||
string iconName, EventHandler func)
|
string iconName, EventHandler<Efl.Ui.IClickableClickedEvt_Args> func)
|
||||||
{
|
{
|
||||||
var button = new Efl.Ui.Button(toolbar);
|
var button = new Efl.Ui.Button(toolbar);
|
||||||
button.SetText(name);
|
button.SetText(name);
|
||||||
|
@ -102,7 +102,7 @@ public class TextEditor : Efl.Csharp.Application
|
||||||
|
|
||||||
// "New" button
|
// "New" button
|
||||||
toolbarButtonNew = GUIToolbarButtonAdd(bar, "New", "document-new",
|
toolbarButtonNew = GUIToolbarButtonAdd(bar, "New", "document-new",
|
||||||
(object sender, EventArgs ea) => {
|
(object sender, Efl.Ui.IClickableClickedEvt_Args ea) => {
|
||||||
// When this button is clicked, remove content and refresh toolbar
|
// When this button is clicked, remove content and refresh toolbar
|
||||||
editorTextBox.SetText("");
|
editorTextBox.SetText("");
|
||||||
GUIToolbarRefresh();
|
GUIToolbarRefresh();
|
||||||
|
@ -110,7 +110,7 @@ public class TextEditor : Efl.Csharp.Application
|
||||||
|
|
||||||
// "Save" button
|
// "Save" button
|
||||||
toolbarButtonSave = GUIToolbarButtonAdd(bar, "Save", "document-save",
|
toolbarButtonSave = GUIToolbarButtonAdd(bar, "Save", "document-save",
|
||||||
(object sender, EventArgs ea) => {
|
(object sender, Efl.Ui.IClickableClickedEvt_Args ea) => {
|
||||||
// When this button is clicked, try to save content and refresh toolbar
|
// When this button is clicked, try to save content and refresh toolbar
|
||||||
try {
|
try {
|
||||||
System.IO.File.WriteAllText(filename, editorTextBox.GetText());
|
System.IO.File.WriteAllText(filename, editorTextBox.GetText());
|
||||||
|
@ -125,7 +125,7 @@ public class TextEditor : Efl.Csharp.Application
|
||||||
|
|
||||||
// "Load" button
|
// "Load" button
|
||||||
toolbarButtonLoad = GUIToolbarButtonAdd(bar, "Load", "document-open",
|
toolbarButtonLoad = GUIToolbarButtonAdd(bar, "Load", "document-open",
|
||||||
(object sender, EventArgs ea) => {
|
(object sender, Efl.Ui.IClickableClickedEvt_Args ea) => {
|
||||||
// When this button is clicked, try to load content and refresh toolbar
|
// When this button is clicked, try to load content and refresh toolbar
|
||||||
try {
|
try {
|
||||||
editorTextBox.SetText(System.IO.File.ReadAllText(filename));
|
editorTextBox.SetText(System.IO.File.ReadAllText(filename));
|
||||||
|
@ -147,7 +147,7 @@ public class TextEditor : Efl.Csharp.Application
|
||||||
bar.Pack(box);
|
bar.Pack(box);
|
||||||
|
|
||||||
// "Quit" button
|
// "Quit" button
|
||||||
GUIToolbarButtonAdd(bar, "Quit", "application-exit", (object sender, EventArgs e) => { Efl.Ui.Config.Exit(); } );
|
GUIToolbarButtonAdd(bar, "Quit", "application-exit", (object sender, Efl.Ui.IClickableClickedEvt_Args e) => { Efl.Ui.Config.Exit(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds the user interface for the text editor
|
// Builds the user interface for the text editor
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class Example : Efl.Csharp.Application
|
||||||
var button = new Efl.Ui.Button(hbox);
|
var button = new Efl.Ui.Button(hbox);
|
||||||
button.SetText("Focus mover");
|
button.SetText("Focus mover");
|
||||||
button.FocusChangedEvt += FocusChangedCb;
|
button.FocusChangedEvt += FocusChangedCb;
|
||||||
button.ClickedEvt += (object sender, EventArgs e) => {
|
button.ClickedEvt += (object sender, Efl.Ui.IClickableClickedEvt_Args e) => {
|
||||||
Console.WriteLine("Clicked Focus Mover");
|
Console.WriteLine("Clicked Focus Mover");
|
||||||
// Manually transfer focus to the first check box
|
// Manually transfer focus to the first check box
|
||||||
Efl.Ui.Focus.Util.Focus(first_checkbox);
|
Efl.Ui.Focus.Util.Focus(first_checkbox);
|
||||||
|
@ -57,7 +57,7 @@ public class Example : Efl.Csharp.Application
|
||||||
button = new Efl.Ui.Button(hbox);
|
button = new Efl.Ui.Button(hbox);
|
||||||
button.SetText("Quit");
|
button.SetText("Quit");
|
||||||
button.FocusChangedEvt += FocusChangedCb;
|
button.FocusChangedEvt += FocusChangedCb;
|
||||||
button.ClickedEvt += (object sender, EventArgs e) => {
|
button.ClickedEvt += (object sender, Efl.Ui.IClickableClickedEvt_Args e) => {
|
||||||
Console.WriteLine("Clicked Quit");
|
Console.WriteLine("Clicked Quit");
|
||||||
Efl.Ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
};
|
};
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class Example : Efl.Csharp.Application
|
||||||
Efl.Ui.Button quit_btn = new Efl.Ui.Button(win);
|
Efl.Ui.Button quit_btn = new Efl.Ui.Button(win);
|
||||||
quit_btn.SetText("Quit");
|
quit_btn.SetText("Quit");
|
||||||
quit_btn.SetHintSizeMax(new Eina.Size2D(150, 30));
|
quit_btn.SetHintSizeMax(new Eina.Size2D(150, 30));
|
||||||
quit_btn.ClickedEvt += (object sender, EventArgs e) => {
|
quit_btn.ClickedEvt += (object sender, Efl.Ui.IClickableClickedEvt_Args e) => {
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
Efl.Ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class Example : Efl.Csharp.Application
|
||||||
button.SetText("Quit");
|
button.SetText("Quit");
|
||||||
button.SetHintWeight(1.0, 0.1);
|
button.SetHintWeight(1.0, 0.1);
|
||||||
// Set the method to be called when the button is pressed
|
// Set the method to be called when the button is pressed
|
||||||
button.ClickedEvt += (object sender, EventArgs e) => { Efl.App.AppMain.Quit(0); };
|
button.ClickedEvt += (object sender, Efl.Ui.IClickableClickedEvt_Args e) => { Efl.App.AppMain.Quit(0); };
|
||||||
// Add the button to the box container
|
// Add the button to the box container
|
||||||
box.Pack(button);
|
box.Pack(button);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue