Esempio n. 1
0
	public static void Main(string [] args)
  {	
		MainLoop.Init();
		Enlightenment.Ecore.Window.Init();
		Edje.Init();
	
		window = Enlightenment.Ecore.Window.SoftwareX11New(":0", null, 0, 0, 640, 480);
		window.ResizeEvent += new Enlightenment.Ecore.Window.EventHandler(_xwindow_resize_cb);
		window.Show();		
	
		XWindow xwindow = window.SoftwareX11WindowGet();
		xwindow.Dnd.Aware = 1;
		xwindow.Dnd.TypeSet("*", 1);
	
		if (xwindow.Dnd.TypeIsSet("*") == 1)
		{
    	Enlightenment.Ecore.Events.SignalExitEvent += new Enlightenment.Ecore.Events.EventHandler(AppSignalExitHandler);
			Enlightenment.Ecore.Events.DndEnterEvent += new Enlightenment.Ecore.Events.EventHandler(AppDndEnterHandler);
			Enlightenment.Ecore.Events.DndLeaveEvent += new Enlightenment.Ecore.Events.EventHandler(AppDndLeaveHandler);
			Enlightenment.Ecore.Events.DndPositionEvent += new Enlightenment.Ecore.Events.EventHandler(AppDndPositionHandler);
			Enlightenment.Ecore.Events.DndDropEvent += new Enlightenment.Ecore.Events.EventHandler(AppDndDropHandler);
			Enlightenment.Ecore.Events.SelectionNotifyEvent += new Enlightenment.Ecore.Events.EventHandler(AppSelectionNotifyHandler);
		}

		Edje background = new Edje(window.Get());
		if (background.FileSet(DataConfig.DATADIR + "/data/test/flower.edj","desktop/background") == 0)
		{
     	System.Console.WriteLine("Can't load edje object!");
		}
		
		background.Focus = 1;
		background.MouseDownEvent  += new Enlightenment.Evas.Item.EventHandler(EdjeMouseDownEventCallback);
		background.MouseInEvent    += new Enlightenment.Evas.Item.EventHandler(EdjeMouseInEventCallback);
		background.MouseOutEvent   += new Enlightenment.Evas.Item.EventHandler(EdjeMouseOutEventCallback);
		background.KeyDownEvent    += new Enlightenment.Evas.Item.EventHandler(EdjeKeyDownEventCallback);
		background.Move(0, 0);
		background.Resize(640, 480);
		background.Show();

		Image image = new Image(window.Get());
		image.Set(DataConfig.DATADIR + "/data/test/images/e.png", null);
		image.Move(0, 0);	
		image.Resize(320, 320);
		image.Fill = new ImageFill (0, 0, 320, 320);
		image.MouseDownEvent += new Enlightenment.Evas.Item.EventHandler(ImageMouseDownEventCallback);
		image.MouseUpEvent += new Enlightenment.Evas.Item.EventHandler(ImageMouseUpEventCallback);
		image.MouseMoveEvent += new Enlightenment.Evas.Item.EventHandler(ImageMouseMoveEventCallback);	
		image.Raise();
		image.Show();
		
		/* Put back when textblock is done */
		/*
		TextBlock textblock = new TextBlock(window.Get());
		textblock.FormatInsert("color=#ffffffff font="+DataConfig.DATADIR+"/data/fonts/Vera.ttf size=16");
		textblock.TextInsert("This is some text for the text block!");
		textblock.FormatInsert("\n");
		textblock.TextInsert("And this text should be on another line!");
		textblock.Move(300, 300);
		textblock.Resize(300, 100);
		textblock.Raise();
		textblock.Show();
		*/

		window.DataSet("image", image);	
		window.DataSet("background", background);
		window.DataSet("xwindow", xwindow);
		
		MainLoop.Begin();
  }
Esempio n. 2
0
  public static void Main(string [] args)
  {	
    Application.Init();

    Window win = new Window("EFL# Demo App");	
    win.Resize(640, 480);

    Application.EE.ResizeEvent += AppResizeHandler;

    /* integrate this code in the Window class */
    Edje win_bg = new Edje(Application.EE.Get());
    win_bg.FileSet(DataConfig.DATADIR + "/data/eblocks/themes/e17.edj","window");
    win_bg.Resize(640, 480);
    win_bg.Move(0, 0);
    win_bg.Lower();
    win_bg.Show();
    
    MenuItem item;    
    MenuItem entry;

    MenuBar mb = new MenuBar();
    mb.Move(0, 0);
    mb.Resize(640, 35);
    mb.Spacing = 15;

    item = new MenuItem("_File");
    Menu file_menu = new Menu();
    
    entry = new MenuItem(file_menu.Canvas, "_Open");
    file_menu.Append(entry);
    entry = new MenuItem(file_menu.Canvas, "_Close");
    file_menu.Append(entry);
    entry = new MenuItem(file_menu.Canvas, "_Save");
    file_menu.Append(entry);
    
    item.SubMenu = file_menu;
    
    mb.Append(item);

    item = new MenuItem("_Edit");
    Menu edit_menu = new Menu();
    
    entry = new MenuItem(edit_menu.Canvas, "_Copy");
    edit_menu.Append(entry);
    entry = new MenuItem(edit_menu.Canvas, "_Cut");
    edit_menu.Append(entry);
    entry = new MenuItem(edit_menu.Canvas, "_Paste");
    edit_menu.Append(entry);
    
    item.SubMenu = edit_menu;
    mb.Append(item);

    item = new MenuItem("_About");
    //item.SubMenu = about_menu;
    mb.Append(item);

    mb.Show();

    Button button;	

    HBox box_left = new HBox();
    box_left.Move(0, 37);
    box_left.Resize(70, 480 - 37);
	
    VBox box_icons = new VBox();
    box_icons.Spacing = 0;
    box_icons.Resize(64, 480 - 37);
	
    button = new Button("Tile");
    button.Resize(64, 64);
    box_icons.PackEnd(button);
    button = new Button("Stretch");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Rotate");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Flip");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Quit");
    button.MouseUpEvent += new Enlightenment.Evas.Item.EventHandler(AppQuitButtonHandler);
    button.Resize(64, 64);	
    box_icons.PackEnd(button);		
	
    box_left.PackEnd(box_icons);
	
    Enlightenment.Eblocks.Line vline = new Enlightenment.Eblocks.Line(Application.EE.Get());
    vline.Vertical = true;
    vline.Resize(6, 480 - 37);
	
    box_left.PackEnd(vline);
	
    box_left.Show();
	
    dir = args[0];	
	       	
    imageTable = new Table(Application.EE.Get(), items);
	
    HBox box_images = new HBox();
    box_images.Move(70, 37);
    box_images.Spacing = 0;
    box_images.Resize(640 - 70 - 2, 480 - 37 - 2);
    box_images.PackStart(imageTable);
	
    Application.EE.DataSet("box_images", box_images);
    Application.EE.DataSet("box_left", box_left);
    Application.EE.DataSet("box_icons", box_icons);
    Application.EE.DataSet("win_bg", win_bg);
    Application.EE.DataSet("vline", vline);
    Application.EE.DataSet("mb", mb);
	
    WaitCallback callback = new WaitCallback(Callback);
    ThreadPool.QueueUserWorkItem(callback);	

    win.ShowAll();
	
    Application.Run();
  }