Author: hisham
Date: 2005-06-09 19:40:05 -0400 (Thu, 09 Jun 2005)
New Revision: 45724
Added:
trunk/efl-sharp/libs/eblocks/
trunk/efl-sharp/libs/eblocks/README
trunk/efl-sharp/libs/eblocks/build.sh
trunk/efl-sharp/libs/eblocks/fonts/
trunk/efl-sharp/libs/eblocks/fonts/Trebuchet_MS_Bold.ttf
trunk/efl-sharp/libs/eblocks/images/
trunk/efl-sharp/libs/eblocks/images/button/
trunk/efl-sharp/libs/eblocks/images/button/button_focused.png
trunk/efl-sharp/libs/eblocks/images/button/button_unfocused.png
trunk/efl-sharp/libs/eblocks/sharp.edc
trunk/efl-sharp/libs/eblocks/sharp.edj
trunk/efl-sharp/libs/eblocks/test.cs
trunk/efl-sharp/libs/eblocks/ui.edc
Modified:
trunk/efl-sharp/apps/image_viewer/image_test.cs
trunk/efl-sharp/libs/efl-sharp/src/lib/evas/evas_extra_container.cs
Log:
some additions to container and its demo app, added eblocks, minimal widget set
using evas / edje for EFL# only
Modified: trunk/efl-sharp/apps/image_viewer/image_test.cs
===================================================================
--- trunk/efl-sharp/apps/image_viewer/image_test.cs 2005-06-09 23:23:28 UTC
(rev 45723)
+++ trunk/efl-sharp/apps/image_viewer/image_test.cs 2005-06-09 23:40:05 UTC
(rev 45724)
@@ -2,6 +2,7 @@
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.IO;
+using System.Threading;
using System.Collections;
using Enlightenment.Evas;
using Enlightenment.Ecore;
@@ -78,7 +79,24 @@
private static Enlightenment.Ecore.Canvas EE = new
Enlightenment.Ecore.Canvas();
private static Container cont;
+ private static Thread thread;
+ private static ArrayList items = new ArrayList();
+
+ private static int app_w = 800;
+ private static int app_h = 600;
+ public static void DrawGui(object state)
+ {
+ thread = Thread.CurrentThread;
+ cont = new Container(EE, items);
+ cont.ItemSize(48, 48);
+ cont.Move(100, 50);
+ cont.Resize(app_w - 100, app_h - 50);
+ cont.Show();
+
+ thread.Abort();
+ }
+
public static int AppSignalExitHandler(object info)
{
System.Console.WriteLine("Quitting main application!");
@@ -104,7 +122,7 @@
Enlightenment.Ecore.MainLoop.Init();
Enlightenment.Ecore.Canvas.Init();
- EE.SoftwareX11New(":0", IntPtr.Zero, 0, 0, 640, 480);
+ EE.SoftwareX11New(":0", IntPtr.Zero, 0, 0, app_w, app_h);
EE.TitleSet("Sharp Container");
EE.NameClassSet("sharp_container","sharp_container");
EE.ResizeEvent += new
Enlightenment.Ecore.Canvas.EventHandler(AppResizeHandler);
@@ -115,25 +133,24 @@
Rectangle bg_rect = new Rectangle(EE.Get());
bg_rect.Move(0, 0);
bg_rect.Color = new Color(228, 226, 212, 255);
- bg_rect.Resize(640, 480);
+ bg_rect.Resize(app_w, app_h);
bg_rect.Lower();
bg_rect.Show();
Rectangle left_toolbar = new Rectangle(EE.Get());
left_toolbar.Move(0, 0);
- left_toolbar.Resize(100, 480);
+ left_toolbar.Resize(100, app_h);
left_toolbar.Color = new Color(124, 126, 101, 200);
left_toolbar.Show();
Rectangle top_toolbar = new Rectangle(EE.Get());
top_toolbar.Move(0, 0);
- top_toolbar.Resize(640, 50);
+ top_toolbar.Resize(app_w, 50);
top_toolbar.Color = new Color(124, 126, 101, 200);
top_toolbar.Show();
DirectoryInfo myDirectory = new DirectoryInfo(args[0]);
- ArrayList items = new ArrayList();
FileInfo[] _files = myDirectory.GetFiles();
foreach (FileInfo file in _files)
{
@@ -146,12 +163,11 @@
EE.DataSet("left_toolbar", left_toolbar);
EE.DataSet("top_toolbar", top_toolbar);
- cont = new Container(EE, items);
- cont.Move(100, 50);
- cont.Resize(540, 430);
- cont.Show();
+ WaitCallback callback = new WaitCallback(DrawGui);
+ ThreadPool.QueueUserWorkItem(callback);
+
-
Enlightenment.Ecore.MainLoop.Begin();
- }
+
+ }
}
Added: trunk/efl-sharp/libs/eblocks/README
===================================================================
--- trunk/efl-sharp/libs/eblocks/README 2005-06-09 23:23:28 UTC (rev 45723)
+++ trunk/efl-sharp/libs/eblocks/README 2005-06-09 23:40:05 UTC (rev 45724)
@@ -0,0 +1,7 @@
+This is some experimental stuff to create a mini widget
+set using Edje and Evas written in C#.
+
+Current widgets:
+
+Box:
+lays out items in a vbox / hbox manner
Added: trunk/efl-sharp/libs/eblocks/build.sh
===================================================================
--- trunk/efl-sharp/libs/eblocks/build.sh 2005-06-09 23:23:28 UTC (rev
45723)
+++ trunk/efl-sharp/libs/eblocks/build.sh 2005-06-09 23:40:05 UTC (rev
45724)
@@ -0,0 +1,4 @@
+edje_cc sharp.edc -id images -fd fonts
+
+mcs test.cs
-r:/usr/lib/mono/gac/efl-sharp/0.0.1.0__56eb9b2d0c525a1a/efl-sharp.dll \
+ -out:test.exe
Property changes on: trunk/efl-sharp/libs/eblocks/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/efl-sharp/libs/eblocks/fonts/Trebuchet_MS_Bold.ttf
===================================================================
(Binary files differ)
Property changes on: trunk/efl-sharp/libs/eblocks/fonts/Trebuchet_MS_Bold.ttf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/efl-sharp/libs/eblocks/images/button/button_focused.png
===================================================================
(Binary files differ)
Property changes on:
trunk/efl-sharp/libs/eblocks/images/button/button_focused.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/efl-sharp/libs/eblocks/images/button/button_unfocused.png
===================================================================
(Binary files differ)
Property changes on:
trunk/efl-sharp/libs/eblocks/images/button/button_unfocused.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/efl-sharp/libs/eblocks/sharp.edc
===================================================================
--- trunk/efl-sharp/libs/eblocks/sharp.edc 2005-06-09 23:23:28 UTC (rev
45723)
+++ trunk/efl-sharp/libs/eblocks/sharp.edc 2005-06-09 23:40:05 UTC (rev
45724)
@@ -0,0 +1,38 @@
+images {
+ image: "button/button_unfocused.png" COMP;
+ image: "button/button_focused.png" COMP;
+}
+
+fonts {
+ font: "Trebuchet_MS_Bold.ttf" "Trebuchet_MS_Bold";
+}
+
+collections {
+ group {
+ name: "button";
+
+ parts {
+
+ // button
+ part {
+ name: "button";
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ image {
+ normal, "button/button_focused.png";
+ border, 2 2 2 2;
+ }
+ }
+ }
+
+ programs {
+ }
+ }
+ }
+}
Added: trunk/efl-sharp/libs/eblocks/sharp.edj
===================================================================
(Binary files differ)
Property changes on: trunk/efl-sharp/libs/eblocks/sharp.edj
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/efl-sharp/libs/eblocks/test.cs
===================================================================
--- trunk/efl-sharp/libs/eblocks/test.cs 2005-06-09 23:23:28 UTC (rev
45723)
+++ trunk/efl-sharp/libs/eblocks/test.cs 2005-06-09 23:40:05 UTC (rev
45724)
@@ -0,0 +1,178 @@
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+using System.Text.RegularExpressions;
+using Enlightenment;
+using Enlightenment.Edje;
+using Enlightenment.Evas;
+using Enlightenment.Ecore;
+
+/*
+ * TODO:
+ * add fill policy
+ */
+
+public class Box
+{
+ private int width = 0;
+ private int height = 0;
+ private int x = 0;
+ private int y = 0;
+ private int spacer = 0;
+
+ private Enlightenment.Evas.Canvas canvas;
+ private Enlightenment.Evas.Rectangle clip;
+
+ private bool horizontal = false;
+ private ArrayList items = new ArrayList();
+
+ public Box(Enlightenment.Evas.Canvas c)
+ {
+ canvas = c;
+ clip = new Enlightenment.Evas.Rectangle(canvas);
+ clip.Color = new Enlightenment.Evas.Color(255, 255, 255, 255);
+ }
+
+ public int Spacing
+ {
+ get { return spacer; }
+ set { spacer = value; }
+ }
+
+ public bool Horizontal
+ {
+ get { return horizontal; }
+ set { horizontal = value; }
+ }
+
+ public void Resize(int w, int h)
+ {
+ width = w;
+ height = h;
+ clip.Resize(w, h);
+ Render();
+ }
+
+ public void Move(int _x, int _y)
+ {
+ x = _x;
+ y = _y;
+ clip.Move(x, y);
+ Render();
+ }
+
+ public void Add(Enlightenment.Evas.Item item)
+ {
+ items.Add(item);
+ }
+
+ public void Show()
+ {
+ clip.Show();
+ }
+
+ public void Hide()
+ {
+ clip.Hide();
+ }
+
+ private void RenderVertical()
+ {
+ Geometry g = new Geometry();
+ g.X = x;
+ g.Y = y;
+ foreach(Enlightenment.Evas.Item item in items)
+ {
+ item.Move(g.X, g.Y);
+ item.Clip = clip;
+ item.Show();
+ g = item.Geometry;
+ g.Y += g.H + 5;
+ }
+ }
+
+ private void RenderHorizontal()
+ {
+ Geometry g = new Geometry();
+ g.X = x;
+ g.Y = y;
+ foreach(Enlightenment.Evas.Item item in items)
+ {
+ item.Move(g.X, g.Y);
+ item.Clip = clip;
+ item.Show();
+ g = item.Geometry;
+ g.X += g.W + 5;
+ }
+ }
+
+ public void Render()
+ {
+ if(horizontal)
+ RenderHorizontal();
+ else
+ RenderVertical();
+ }
+}
+
+public class EcoreEvasTest
+{
+
+ private static Enlightenment.Ecore.Canvas EE = new
Enlightenment.Ecore.Canvas();
+
+ public static void Main(string [] args)
+ {
+ MainLoop.Init();
+ Enlightenment.Ecore.Canvas.Init();
+ Edje.Init();
+
+ EE.SoftwareX11New(":0", IntPtr.Zero, 0, 0, 640, 480);
+
+ EE.Show();
+
+
+ Rectangle bg_rect = new Rectangle(EE.Get());
+ bg_rect.Move(0, 0);
+ bg_rect.Resize(640, 480);
+ bg_rect.Lower();
+ bg_rect.Show();
+
+ Edje button_ok = new Edje(EE.Get());
+ button_ok.FileSet("sharp.edj","button");
+ button_ok.Focus = 1;
+ button_ok.Resize(50, 25);
+ button_ok.StackAbove(bg_rect);
+ //button_ok.MouseDownEvent += new
Enlightenment.Evas.Item.EventHandler(EdjeMouseDownEventCallback);
+ //button_ok.MouseInEvent += new
Enlightenment.Evas.Item.EventHandler(EdjeMouseInEventCallback);
+ //button_ok.MouseOutEvent += new
Enlightenment.Evas.Item.EventHandler(EdjeMouseOutEventCallback);
+ //button_ok.Move(10, 10);
+ button_ok.Show();
+
+ Box box = new Box(EE.Get());
+ box.Add(button_ok);
+
+ button_ok = new Edje(EE.Get());
+ button_ok.FileSet("sharp.edj","button");
+ button_ok.Focus = 1;
+ button_ok.Resize(50, 25);
+ button_ok.StackAbove(bg_rect);
+ //button_ok.MouseDownEvent += new
Enlightenment.Evas.Item.EventHandler(EdjeMouseDownEventCallback);
+ //button_ok.MouseInEvent += new
Enlightenment.Evas.Item.EventHandler(EdjeMouseInEventCallback);
+ //button_ok.MouseOutEvent += new
Enlightenment.Evas.Item.EventHandler(EdjeMouseOutEventCallback);
+ //button_ok.Move(10, 10);
+ button_ok.Show();
+
+ box.Add(button_ok);
+
+ box.Horizontal = true;
+ box.Spacing = 5;
+ box.Move(10, 10);
+ box.Resize(200, 200);
+ box.Render();
+ box.Show();
+
+ EE.DataSet("button_ok", button_ok);
+
+ MainLoop.Begin();
+ }
+}
Added: trunk/efl-sharp/libs/eblocks/ui.edc
===================================================================
--- trunk/efl-sharp/libs/eblocks/ui.edc 2005-06-09 23:23:28 UTC (rev 45723)
+++ trunk/efl-sharp/libs/eblocks/ui.edc 2005-06-09 23:40:05 UTC (rev 45724)
@@ -0,0 +1,74 @@
+images {
+ image: "button/button_unfocused.png" COMP;
+ image: "button/button_focused.png" COMP;
+}
+
+fonts {
+ font: "Trebuchet_MS_Bold.ttf" "Trebuchet_MS_Bold";
+}
+
+collections {
+ group {
+ name: "Sharp";
+ min: 320 240;
+
+ parts {
+
+ // main application window
+ part {
+ name: "interface";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ color: 255 255 255 255;
+ }
+ }
+
+ // vbar for packing;
+ part {
+ name: "vbar";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 0 0 128;
+ rel1 {
+ relative: 0.0 1.0;
+ offset: 0 -35;
+ to: "interface";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "interface";
+ }
+ }
+ }
+
+ // button
+ part {
+ name: "button_ok";
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 1.0 0.0;
+ offset: -60 1;
+ to: "vbar";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: -6 -2;
+ to: "vbar";
+ }
+ image {
+ normal, "button/button_focused.png";
+ border, 2 2 2 2;
+ }
+ }
+ }
+
+ programs {
+ }
+ }
+ }
+}
Modified: trunk/efl-sharp/libs/efl-sharp/src/lib/evas/evas_extra_container.cs
===================================================================
--- trunk/efl-sharp/libs/efl-sharp/src/lib/evas/evas_extra_container.cs
2005-06-09 23:23:28 UTC (rev 45723)
+++ trunk/efl-sharp/libs/efl-sharp/src/lib/evas/evas_extra_container.cs
2005-06-09 23:40:05 UTC (rev 45724)
@@ -100,6 +100,12 @@
clip.StackBelow(events_rect);
}
+ public void ItemSize(int w, int h)
+ {
+ obj_w = w;
+ obj_h = h;
+ }
+
public void Move(int x, int y)
{
x_offset = x;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches