Further fixes to adapt to latest API changes
This commit is contained in:
parent
d16b7e48bc
commit
3e1aefa7ea
|
@ -106,9 +106,9 @@ _gui_setup()
|
||||||
efl_text_font_set(efl_added, "Mono", 14),
|
efl_text_font_set(efl_added, "Mono", 14),
|
||||||
efl_text_multiline_set(efl_added, EINA_TRUE),
|
efl_text_multiline_set(efl_added, EINA_TRUE),
|
||||||
efl_text_interactive_editable_set(efl_added, EINA_TRUE),
|
efl_text_interactive_editable_set(efl_added, EINA_TRUE),
|
||||||
efl_ui_text_scrollable_set(efl_added, EINA_TRUE),
|
|
||||||
efl_event_callback_array_add(efl_added, _editor_callbacks(), NULL),
|
efl_event_callback_array_add(efl_added, _editor_callbacks(), NULL),
|
||||||
efl_pack(box, efl_added));
|
efl_pack(box, efl_added));
|
||||||
|
efl_ui_text_scrollable_set(_editor, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI_MAIN void
|
EAPI_MAIN void
|
||||||
|
|
|
@ -10,10 +10,11 @@ public class LifeWindow
|
||||||
lifeRender.RenderLayout((Efl.Ui.Win)sender);
|
lifeRender.RenderLayout((Efl.Ui.Win)sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuitEvt(object sender, EventArgs ev)
|
void QuitEvt(object sender, Efl.Gfx.EntityVisibilityChangedEvt_Args ev)
|
||||||
{
|
{
|
||||||
// quit the mainloop
|
// quit the mainloop
|
||||||
Efl.Ui.Config.Exit();
|
if (ev.arg == false)
|
||||||
|
Efl.Ui.Config.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchEvt(object sender, Efl.Input.InterfacePointerDownEvt_Args ev)
|
void TouchEvt(object sender, Efl.Input.InterfacePointerDownEvt_Args ev)
|
||||||
|
@ -42,7 +43,7 @@ public class LifeWindow
|
||||||
win.SetAutohide(true);
|
win.SetAutohide(true);
|
||||||
|
|
||||||
// when the user clicks "close" on a window there is a request to hide
|
// when the user clicks "close" on a window there is a request to hide
|
||||||
((Efl.Gfx.Entity)win).HideEvt += QuitEvt;
|
((Efl.Gfx.Entity)win).VisibilityChangedEvt += QuitEvt;
|
||||||
|
|
||||||
Eina.Size2D sz;
|
Eina.Size2D sz;
|
||||||
sz.W = (int)(10 * LifeBoard.Width * win.GetScale());
|
sz.W = (int)(10 * LifeBoard.Width * win.GetScale());
|
||||||
|
@ -52,7 +53,7 @@ public class LifeWindow
|
||||||
lifeRender = new LifeRender(win, lifeBoard);
|
lifeRender = new LifeRender(win, lifeBoard);
|
||||||
lifeRender.Refresh(win);
|
lifeRender.Refresh(win);
|
||||||
|
|
||||||
((Efl.Gfx.Entity)win).ResizeEvt += ResizeEvt;
|
((Efl.Gfx.Entity)win).SizeChangedEvt += ResizeEvt;
|
||||||
((Efl.Input.Interface)win).PointerDownEvt += TouchEvt;
|
((Efl.Input.Interface)win).PointerDownEvt += TouchEvt;
|
||||||
((Efl.Input.Interface)win).KeyDownEvt += KeyDownEvt;
|
((Efl.Input.Interface)win).KeyDownEvt += KeyDownEvt;
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,10 @@ public class TextEditor
|
||||||
"texteditor_example.txt");
|
"texteditor_example.txt");
|
||||||
|
|
||||||
// Quits the application
|
// Quits the application
|
||||||
private void GUIQuitCb(object sender, EventArgs ea)
|
private void GUIQuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEvt_Args ea)
|
||||||
{
|
{
|
||||||
Efl.Ui.Config.Exit();
|
if (ea.arg == false)
|
||||||
|
Efl.Ui.Config.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enables or disables buttons on the toolbar as required
|
// Enables or disables buttons on the toolbar as required
|
||||||
|
@ -146,7 +147,7 @@ public class TextEditor
|
||||||
bar.DoPack(box);
|
bar.DoPack(box);
|
||||||
|
|
||||||
// "Quit" button
|
// "Quit" button
|
||||||
GUIToolbarButtonAdd(bar, "Quit", "application-exit", GUIQuitCb);
|
GUIToolbarButtonAdd(bar, "Quit", "application-exit", (object sender, EventArgs e) => { Efl.Ui.Config.Exit(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds the user interface for the text editor
|
// Builds the user interface for the text editor
|
||||||
|
@ -156,7 +157,7 @@ public class TextEditor
|
||||||
win = new Efl.Ui.Win(parent: Efl.App.AppMain);
|
win = new Efl.Ui.Win(parent: Efl.App.AppMain);
|
||||||
win.SetText("Text Editor");
|
win.SetText("Text Editor");
|
||||||
win.SetAutohide(true);
|
win.SetAutohide(true);
|
||||||
win.HideEvt += GUIQuitCb;
|
win.VisibilityChangedEvt += GUIQuitCb;
|
||||||
|
|
||||||
// Create a vertical box container
|
// Create a vertical box container
|
||||||
Efl.Ui.Box box = new Efl.Ui.Box(win);
|
Efl.Ui.Box box = new Efl.Ui.Box(win);
|
||||||
|
@ -168,10 +169,10 @@ public class TextEditor
|
||||||
// Create the main text entry
|
// Create the main text entry
|
||||||
editorTextBox = new Efl.Ui.Text(box);
|
editorTextBox = new Efl.Ui.Text(box);
|
||||||
editorTextBox.SetFont("Mono", 14);
|
editorTextBox.SetFont("Mono", 14);
|
||||||
editorTextBox.SetMultiline(true);
|
editorTextBox.Multiline = true;
|
||||||
editorTextBox.SetEditable(true);
|
editorTextBox.Editable = true;
|
||||||
editorTextBox.SetScrollable(true);
|
editorTextBox.Scrollable = true;
|
||||||
editorTextBox.SetHintMin(new Eina.Size2D(360, 240));
|
editorTextBox.SetHintSizeMin(new Eina.Size2D(360, 240));
|
||||||
editorTextBox.ChangedEvt += EditorChangedCb;
|
editorTextBox.ChangedEvt += EditorChangedCb;
|
||||||
editorTextBox.ChangedUserEvt += EditorChangedCb;
|
editorTextBox.ChangedUserEvt += EditorChangedCb;
|
||||||
box.DoPack(editorTextBox);
|
box.DoPack(editorTextBox);
|
||||||
|
|
|
@ -22,7 +22,7 @@ _io_write(const char *filename)
|
||||||
Efl_Io_File *file;
|
Efl_Io_File *file;
|
||||||
|
|
||||||
file = efl_new(EFL_IO_FILE_CLASS,
|
file = efl_new(EFL_IO_FILE_CLASS,
|
||||||
efl_file_set(efl_added, filename, NULL), // mandatory
|
efl_file_set(efl_added, filename), // mandatory
|
||||||
efl_io_file_flags_set(efl_added, O_WRONLY | O_CREAT), // write and create - default is read
|
efl_io_file_flags_set(efl_added, O_WRONLY | O_CREAT), // write and create - default is read
|
||||||
efl_io_file_mode_set(efl_added, 0644), // neccessary if we use O_CREAT
|
efl_io_file_mode_set(efl_added, 0644), // neccessary if we use O_CREAT
|
||||||
efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE)); // recommended
|
efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE)); // recommended
|
||||||
|
@ -51,7 +51,7 @@ _io_read(const char *filename)
|
||||||
Efl_Io_File *file;
|
Efl_Io_File *file;
|
||||||
|
|
||||||
file = efl_new(EFL_IO_FILE_CLASS,
|
file = efl_new(EFL_IO_FILE_CLASS,
|
||||||
efl_file_set(efl_added, filename, NULL), // mandatory
|
efl_file_set(efl_added, filename), // mandatory
|
||||||
efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE)); // recommended
|
efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE)); // recommended
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
|
|
|
@ -50,7 +50,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
||||||
efl_add(EFL_UI_BUTTON_CLASS, win,
|
efl_add(EFL_UI_BUTTON_CLASS, win,
|
||||||
efl_text_set(efl_added, "Big Button"),
|
efl_text_set(efl_added, "Big Button"),
|
||||||
efl_pack_end(box, efl_added),
|
efl_pack_end(box, efl_added),
|
||||||
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)));
|
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 100)));
|
||||||
|
|
||||||
efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 320));
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 320));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,15 +20,16 @@ public class Example
|
||||||
win.SetWinType(Efl.Ui.WinType.Basic);
|
win.SetWinType(Efl.Ui.WinType.Basic);
|
||||||
win.SetText("Focus example");
|
win.SetText("Focus example");
|
||||||
win.SetAutohide(true);
|
win.SetAutohide(true);
|
||||||
win.HideEvt += (object sender, EventArgs e) => {
|
win.VisibilityChangedEvt += (object sender, Efl.Gfx.EntityVisibilityChangedEvt_Args e) => {
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
Efl.Ui.Config.Exit();
|
if (e.arg == false)
|
||||||
|
Efl.Ui.Config.Exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Create the main box container
|
// Create the main box container
|
||||||
var vbox = new Efl.Ui.Box(win);
|
var vbox = new Efl.Ui.Box(win);
|
||||||
vbox.SetHintMin(new Eina.Size2D(360, 240));
|
vbox.SetHintSizeMin(new Eina.Size2D(360, 240));
|
||||||
win.SetContent(vbox);
|
win.SetContent(vbox);
|
||||||
|
|
||||||
// Create some check boxes
|
// Create some check boxes
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class Example
|
||||||
if (i == 2)
|
if (i == 2)
|
||||||
{
|
{
|
||||||
// Button 2 has its maximum size limited, so it will be smaller
|
// Button 2 has its maximum size limited, so it will be smaller
|
||||||
button.SetHintMax(new Eina.Size2D(100,50));
|
button.SetHintSizeMax(new Eina.Size2D(100,50));
|
||||||
}
|
}
|
||||||
box.DoPack(button);
|
box.DoPack(button);
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,10 @@ public class Example
|
||||||
win.SetWinType(Efl.Ui.WinType.Basic);
|
win.SetWinType(Efl.Ui.WinType.Basic);
|
||||||
win.SetText("Container demo");
|
win.SetText("Container demo");
|
||||||
win.SetAutohide(true);
|
win.SetAutohide(true);
|
||||||
win.HideEvt += (object sender, EventArgs e) => {
|
win.VisibilityChangedEvt += (object sender, Efl.Gfx.EntityVisibilityChangedEvt_Args e) => {
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
Efl.Ui.Config.Exit();
|
if (e.arg == false)
|
||||||
|
Efl.Ui.Config.Exit();
|
||||||
};
|
};
|
||||||
// Give the window an initial size so there is room to resize the panes.
|
// Give the window an initial size so there is room to resize the panes.
|
||||||
// Otherwise, all widgets are tightly packed
|
// Otherwise, all widgets are tightly packed
|
||||||
|
@ -103,7 +104,7 @@ public class Example
|
||||||
// container
|
// container
|
||||||
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.SetHintMax(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, EventArgs e) => {
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
Efl.Ui.Config.Exit();
|
Efl.Ui.Config.Exit();
|
||||||
|
|
|
@ -23,9 +23,10 @@ public class Example
|
||||||
win.SetWinType(Efl.Ui.WinType.Basic);
|
win.SetWinType(Efl.Ui.WinType.Basic);
|
||||||
win.SetText("Size Control");
|
win.SetText("Size Control");
|
||||||
win.SetAutohide(true);
|
win.SetAutohide(true);
|
||||||
win.HideEvt += (object sender, EventArgs e) => {
|
win.VisibilityChangedEvt += (object sender, Efl.Gfx.EntityVisibilityChangedEvt_Args e) => {
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
Efl.Ui.Config.Exit();
|
if (e.arg == false)
|
||||||
|
Efl.Ui.Config.Exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a box container
|
// Create a box container
|
||||||
|
@ -40,13 +41,13 @@ public class Example
|
||||||
// Create a small button (max size is limited)
|
// Create a small button (max size is limited)
|
||||||
button = new Efl.Ui.Button(win);
|
button = new Efl.Ui.Button(win);
|
||||||
button.SetText("Small");
|
button.SetText("Small");
|
||||||
button.SetHintMax(new Eina.Size2D(50,50));
|
button.SetHintSizeMax(new Eina.Size2D(50,50));
|
||||||
box.DoPack(button);
|
box.DoPack(button);
|
||||||
|
|
||||||
// Create a big button (min size is limited)
|
// Create a big button (min size is limited)
|
||||||
button = new Efl.Ui.Button(win);
|
button = new Efl.Ui.Button(win);
|
||||||
button.SetText("Big button");
|
button.SetText("Big button");
|
||||||
button.SetHintMin(new Eina.Size2D(100,100));
|
button.SetHintSizeMin(new Eina.Size2D(100,100));
|
||||||
box.DoPack(button);
|
box.DoPack(button);
|
||||||
|
|
||||||
// Start the EFL main loop
|
// Start the EFL main loop
|
||||||
|
|
|
@ -3,10 +3,11 @@ using System;
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
// Callback to quit the application
|
// Callback to quit the application
|
||||||
public static void QuitCb(object sender, EventArgs e)
|
public static void QuitCb(object sender, Efl.Gfx.EntityVisibilityChangedEvt_Args e)
|
||||||
{
|
{
|
||||||
// Exit the EFL main loop
|
// Exit the EFL main loop
|
||||||
Efl.Ui.Config.Exit();
|
if (e.arg == false)
|
||||||
|
Efl.Ui.Config.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WIN32
|
#if WIN32
|
||||||
|
@ -25,12 +26,12 @@ public class Example
|
||||||
// button is pressed
|
// button is pressed
|
||||||
win.SetAutohide(true);
|
win.SetAutohide(true);
|
||||||
// Hook to the Hide event
|
// Hook to the Hide event
|
||||||
win.HideEvt += QuitCb;
|
win.VisibilityChangedEvt += QuitCb;
|
||||||
|
|
||||||
// Create a box container
|
// Create a box container
|
||||||
var box = new Efl.Ui.Box(win);
|
var box = new Efl.Ui.Box(win);
|
||||||
// Set its minimum size
|
// Set its minimum size
|
||||||
box.SetHintMin(new Eina.Size2D(360, 240));
|
box.SetHintSizeMin(new Eina.Size2D(360, 540));
|
||||||
// Set the box as the content for the window
|
// Set the box as the content for the window
|
||||||
// The window size will adapt to the box size
|
// The window size will adapt to the box size
|
||||||
win.SetContent(box);
|
win.SetContent(box);
|
||||||
|
@ -51,7 +52,7 @@ public class Example
|
||||||
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 += QuitCb;
|
button.ClickedEvt += (object sender, EventArgs e) => { Efl.Ui.Config.Exit(); };
|
||||||
// Add the button to the box container
|
// Add the button to the box container
|
||||||
box.DoPack(button);
|
box.DoPack(button);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue