Ejemplo 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();
    }