Compare commits
1 Commits
master
...
devs/bu5hm
Author | SHA1 | Date |
---|---|---|
Marcel Hollerbach | bc239358bf |
|
@ -1,9 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class LifeWindow
|
public class LifeWindow : Efl.Csharp.Application
|
||||||
{
|
{
|
||||||
private LifeBoard lifeBoard;
|
private LifeBoard lifeBoard;
|
||||||
private LifeRender lifeRender;
|
private LifeRender lifeRender;
|
||||||
|
private Efl.Ui.Win win;
|
||||||
|
public LifeWindow() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ResizeEvt(object sender, EventArgs ev)
|
void ResizeEvt(object sender, EventArgs ev)
|
||||||
{
|
{
|
||||||
|
@ -30,14 +34,13 @@ public class LifeWindow
|
||||||
|
|
||||||
void KeyDownEvt(object sender, Efl.Input.InterfaceKeyDownEvt_Args ev)
|
void KeyDownEvt(object sender, Efl.Input.InterfaceKeyDownEvt_Args ev)
|
||||||
{
|
{
|
||||||
Efl.Ui.Win win = (Efl.Ui.Win)sender;
|
|
||||||
if (ev.arg.GetKey() == "space")
|
if (ev.arg.GetKey() == "space")
|
||||||
lifeBoard.TogglePause(win);
|
lifeBoard.TogglePause(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LifeWindow()
|
protected override void OnInitialize(Eina.Array<System.String> args)
|
||||||
{
|
{
|
||||||
Efl.Ui.Win win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
|
win = new Efl.Ui.Win(null, (Efl.Ui.Win ewin) => {
|
||||||
ewin.SetWinType(Efl.Ui.WinType.Basic);
|
ewin.SetWinType(Efl.Ui.WinType.Basic);
|
||||||
ewin.SetText("EFL Life");
|
ewin.SetText("EFL Life");
|
||||||
ewin.SetAutohide(true);
|
ewin.SetAutohide(true);
|
||||||
|
@ -62,19 +65,27 @@ public class LifeWindow
|
||||||
|
|
||||||
lifeBoard.Run(win);
|
lifeBoard.Run(win);
|
||||||
}
|
}
|
||||||
|
protected void OnPause() {
|
||||||
|
if (win != null) {
|
||||||
|
lifeBoard.TogglePause(win);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected void OnResume() {
|
||||||
|
if (win != null) {
|
||||||
|
lifeBoard.TogglePause(win);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected void OnTerminate() {
|
||||||
|
Console.WriteLine("Goodbye.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
Efl.All.Init(Efl.Components.Ui);
|
|
||||||
|
|
||||||
var lifeWin = new LifeWindow();
|
var lifeWin = new LifeWindow();
|
||||||
|
|
||||||
// start the mainloop
|
lifeWin.Launch();
|
||||||
Efl.Ui.Config.Run();
|
|
||||||
|
|
||||||
Efl.All.Shutdown();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class TextEditor
|
public class TextEditor : Efl.Csharp.Application
|
||||||
{
|
{
|
||||||
private Efl.Ui.Win win; // The main window
|
private Efl.Ui.Win win; // The main window
|
||||||
private Efl.Ui.Text editorTextBox; // The main text entry
|
private Efl.Ui.Text editorTextBox; // The main text entry
|
||||||
|
@ -31,6 +31,10 @@ public class TextEditor
|
||||||
private readonly string filename = System.IO.Path.Combine(System.IO.Path.GetTempPath(),
|
private readonly string filename = System.IO.Path.Combine(System.IO.Path.GetTempPath(),
|
||||||
"texteditor_example.txt");
|
"texteditor_example.txt");
|
||||||
|
|
||||||
|
public TextEditor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Quits the application
|
// Quits the application
|
||||||
private void GUIQuitCb(object sender, EventArgs ea)
|
private void GUIQuitCb(object sender, EventArgs ea)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +158,7 @@ public class TextEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds the user interface for the text editor
|
// Builds the user interface for the text editor
|
||||||
public TextEditor()
|
protected override void OnInitialize(Eina.Array<System.String> args)
|
||||||
{
|
{
|
||||||
// Create a window and initialize it
|
// Create a window and initialize it
|
||||||
win = new Efl.Ui.Win(Efl.App.AppMain, (Efl.Ui.Win ewin) => {
|
win = new Efl.Ui.Win(Efl.App.AppMain, (Efl.Ui.Win ewin) => {
|
||||||
|
@ -185,13 +189,6 @@ public class TextEditor
|
||||||
// Initial refresh of the toolbar buttons
|
// Initial refresh of the toolbar buttons
|
||||||
GUIToolbarRefresh();
|
GUIToolbarRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method won't return until the application quits
|
|
||||||
public void Run()
|
|
||||||
{
|
|
||||||
// Start the EFL main loop
|
|
||||||
Efl.Ui.Config.Run();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Example
|
public class Example
|
||||||
|
@ -201,14 +198,8 @@ public class Example
|
||||||
#endif
|
#endif
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Initialize EFL and all UI components
|
TextEditor editor = new TextEditor();
|
||||||
Efl.All.Init(Efl.Components.Ui);
|
editor.Launch();
|
||||||
|
|
||||||
var textEditor = new TextEditor();
|
|
||||||
textEditor.Run();
|
|
||||||
|
|
||||||
// Shutdown EFL
|
|
||||||
Efl.All.Shutdown();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,15 +45,15 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
||||||
efl_content_set(win, efl_added));
|
efl_content_set(win, efl_added));
|
||||||
|
|
||||||
efl_add(EFL_UI_BUTTON_CLASS, win,
|
efl_add(EFL_UI_BUTTON_CLASS, win,
|
||||||
efl_ui_translatable_text_set(efl_added, "Translations", _TEXT_DOMAIN),
|
// efl_ui_translatable_text_set(efl_added, "Translations", _TEXT_DOMAIN),
|
||||||
efl_pack_end(box, efl_added));
|
efl_pack_end(box, efl_added));
|
||||||
|
|
||||||
efl_add(EFL_UI_BUTTON_CLASS, win,
|
efl_add(EFL_UI_BUTTON_CLASS, win,
|
||||||
efl_ui_translatable_text_set(efl_added, "Help", _TEXT_DOMAIN),
|
// efl_ui_translatable_text_set(efl_added, "Help", _TEXT_DOMAIN),
|
||||||
efl_pack_end(box, efl_added));
|
efl_pack_end(box, efl_added));
|
||||||
|
|
||||||
efl_add(EFL_UI_BUTTON_CLASS, win,
|
efl_add(EFL_UI_BUTTON_CLASS, win,
|
||||||
efl_ui_translatable_text_set(efl_added, "Quit", _TEXT_DOMAIN),
|
// efl_ui_translatable_text_set(efl_added, "Quit", _TEXT_DOMAIN),
|
||||||
efl_pack_end(box, efl_added),
|
efl_pack_end(box, efl_added),
|
||||||
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(100, 100)),
|
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(100, 100)),
|
||||||
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
|
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
|
||||||
|
|
Loading…
Reference in New Issue