Ejemplo n.º 1
0
    public TestMain(String border_file)
    {
        ecore_evas = new EcoreEvas();
        eina.Size2D     size     = new eina.Size2D();
        eina.Position2D position = new eina.Position2D();
        canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        bg = new efl.canvas.RectangleConcrete(canvas);
        bg.SetColor(255, 255, 255, 255);
        position.X = 0;
        position.Y = 0;
        bg.SetPosition(position);
        size.W = WIDTH;
        size.H = HEIGHT;
        bg.SetSize(size);
        bg.SetVisible(true);
        bg.SetKeyFocus(true);

        bg.KEY_DOWN += On_KeyDown;

        text = new evas.TextConcrete(canvas);
        text.SetStyle(evas.Text_Style_Type.OutlineSoftShadow);

        text.SetColor(0, 0, 0, 255);
        text.SetGlowColor(255, 0, 0, 255);
        text.SetOutlineColor(0, 0, 255, 255);
        text.SetShadowColor(0, 255, 255, 255);
        text.SetFont("Courier", 30);

        text.SetText("sample text");
        size.W = 3 * WIDTH / 4;
        size.H = HEIGHT / 4;
        text.SetSize(size);
        position.X = WIDTH / 8;
        position.Y = 3 * HEIGHT / 8;
        text.SetPosition(position);
        text.SetVisible(true);

        efl.font.Size font_size = 0;
        String        font      = String.Empty;

        text.GetFont(out font, out font_size);
        Console.WriteLine("Adding text object with font {0} and size {1}", font, size);

        // setup border
        border = new evas.ImageConcrete(canvas);
        border.SetFile(border_file, null);
        border.SetBorder(3, 3, 3, 3);
        border.SetBorderCenterFill(0);

        size.W = 3 * WIDTH / 4 + 3;
        size.H = HEIGHT / 4 + 3;
        border.SetSize(size);
        position.X = WIDTH / 8 - 3;
        position.Y = 3 * HEIGHT / 8 - 3;
        border.SetPosition(position);
        border.SetVisible(true);
    }
Ejemplo n.º 2
0
    static void Main(string[] args)
    {
        int color_index = 0;

        efl.All.Init();

        efl.Loop  loop       = new efl.Loop();
        EcoreEvas ecore_evas = new EcoreEvas();

        efl.canvas.IObject canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        efl.IObject parent = canvas.GetParent();
        System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);

        efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
        rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255);
        eina.Size2D size = new eina.Size2D();
        size.W = 640;
        size.H = 480;
        rect.SetSize(size);
        rect.SetVisible(true);

        canvas.KeyDownEvt += (object sender, efl.input.Interface.KeyDownEvt_Args e) => {
            color_index = (color_index + 1) % 3;
            Console.WriteLine("Key Down");
            Console.WriteLine("Got key obj at {0}", e.arg.raw_handle.ToString("X"));
            Console.WriteLine("Got key_get() == [{0}]", e.arg.GetKey());
            rect.SetColor(colors[color_index, 0],
                          colors[color_index, 1],
                          colors[color_index, 2], 255);
        };

        loop.Begin();

        efl.All.Shutdown();
    }
Ejemplo n.º 3
0
    static void Main(string[] args)
    {
        efl.All.Init();

        efl.Loop loop = new efl.Loop();


        EcoreEvas ecore_evas = new EcoreEvas();

        efl.canvas.IObject canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        efl.IObject parent = canvas.GetParent();
        System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);

        evas.IBox   box  = new MyBox(canvas);
        eina.Size2D size = new eina.Size2D();

        size.W = 320;
        size.H = 240;

        box.SetSize(size);
        box.SetVisible(true);

        efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
        rect.SetColor(0, 0, 255, 255);
        size.W = 320;
        size.H = 120;
        rect.SetSize(size);
        rect.SetVisible(true);
        box.Append(rect);

        efl.canvas.Rectangle rect2 = new efl.canvas.Rectangle(canvas);
        rect2.SetColor(0, 255, 0, 255);
        rect2.SetSize(size);
        rect2.SetVisible(true);
        box.Append(rect2);

        loop.Begin();

        efl.All.Shutdown();
    }
Ejemplo n.º 4
0
    static void Main(string[] args)
    {
        efl.All.Init();

        efl.Loop loop = new efl.Loop();

        EcoreEvas ecore_evas = new EcoreEvas();

        eina.Size2D     size = new eina.Size2D();
        eina.Position2D pos  = new eina.Position2D();

        efl.canvas.IObject canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
        bg.SetColor(255, 255, 255, 255);
        pos.X = 0;
        pos.Y = 0;
        bg.SetPosition(pos);
        size.W = WIDTH;
        size.H = HEIGHT;
        bg.SetSize(size);
        bg.SetVisible(true);

        string path = args[0];

        evas.Image logo = new evas.Image(canvas);
        logo.SetFillAuto(true);

        // TODO add preloaded support (depends on events)

        logo.SetFile(path, null);
        size.W = WIDTH / 2;
        size.H = HEIGHT / 2;
        logo.SetSize(size);

        // TODO add a bunch of key/mouse handlers

        logo.SetVisible(true);

        int[]         pixels    = new int[(WIDTH / 4) * (HEIGHT / 4)];
        System.Random generator = new System.Random();
        for (int i = 0; i < pixels.Length; i++)
        {
            pixels[i] = generator.Next();
        }

        evas.Image noise_img = new evas.Image(canvas);
        size.W = WIDTH / 4;
        size.H = HEIGHT / 4;
        noise_img.SetSize(size);
        // FIXME Add a way to set the pixels.
        // noise_img.data_set(pixels);
        noise_img.SetFillAuto(true);
        pos.X = WIDTH * 5 / 8;
        pos.Y = HEIGHT / 8;
        noise_img.SetPosition(pos);
        noise_img.SetVisible(true);
        Console.WriteLine("Creating noise image with sizez %d, %d", WIDTH / 4, HEIGHT / 4);

        efl.canvas.Proxy proxy_img = new efl.canvas.Proxy(canvas);
        proxy_img.SetSource(noise_img);
        pos.X = WIDTH / 2;
        pos.Y = HEIGHT / 2;
        proxy_img.SetPosition(pos);
        size.W = WIDTH / 2;
        size.H = HEIGHT / 2;
        proxy_img.SetSize(size);
        proxy_img.SetVisible(true);

        loop.Begin();
    }
Ejemplo n.º 5
0
    static void Main(string[] args)
    {
        efl.All.Init();

        efl.Loop loop = new efl.Loop();

        EcoreEvas ecore_evas = new EcoreEvas();

        eina.Size2D size = new eina.Size2D();
        size.W = WIDTH;
        size.H = HEIGHT;

        eina.Size2D hint = new eina.Size2D();

        efl.canvas.IObject canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        efl.IObject parent = canvas.GetParent();
        System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);

        efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
        bg.SetColor(255, 255, 255, 255);
        bg.SetSize(size);
        bg.SetVisible(true);


        evas.Table table = new evas.Table(canvas);
        table.SetHomogeneous(evas.object_table.Homogeneous_Mode.None);
        table.SetPadding(0, 0);
        table.SetSize(size);
        table.SetVisible(true);

        efl.canvas.Rectangle rect = new efl.canvas.Rectangle(canvas);
        rect.SetColor(255, 0, 0, 255);
        hint.W = 100;
        hint.H = 50;
        rect.SetHintMin(hint);
        rect.SetVisible(true);
        table.Pack(rect, 1, 1, 2, 1);

        rect = new efl.canvas.Rectangle(canvas);
        rect.SetColor(0, 255, 0, 255);
        hint.W = 50;
        hint.H = 100;
        rect.SetHintMin(hint);
        rect.SetVisible(true);
        table.Pack(rect, 1, 2, 1, 2);

        rect = new efl.canvas.Rectangle(canvas);
        rect.SetColor(0, 0, 255, 255);
        hint.W = 50;
        hint.H = 50;
        rect.SetHintMin(hint);
        rect.SetVisible(true);
        table.Pack(rect, 2, 2, 1, 1);

        rect = new efl.canvas.Rectangle(canvas);
        rect.SetColor(255, 255, 0, 255);
        rect.SetHintMin(hint);
        rect.SetVisible(true);
        table.Pack(rect, 2, 3, 1, 1);

        loop.Begin();

        efl.All.Shutdown();
    }
Ejemplo n.º 6
0
    static void Main(string[] args)
    {
        efl.All.Init();

        efl.Loop loop = new efl.Loop();

        EcoreEvas ecore_evas = new EcoreEvas();

        eina.Size2D size = new eina.Size2D();

        efl.canvas.IObject canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        efl.IObject parent = canvas.GetParent();
        System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);

        efl.canvas.Rectangle bg = new efl.canvas.Rectangle(canvas);
        bg.SetColor(255, 255, 255, 255);
        size.W = WIDTH;
        size.H = HEIGHT;
        bg.SetSize(size);
        bg.SetVisible(true);

        string valid_path = args[0];

        evas.Image image = new evas.Image(canvas);
        image.SetFile(valid_path, null);

        /* FIXME evas-image uses error handling code from
         * evas_object_image_load_error_get, which seems to be not available
         * efl.image.load.State state = image.load_error_get(); */

        // FIXME missing move
        eina.Rect rect = new eina.Rect();

        rect.X = 0;
        rect.Y = 0;
        rect.W = WIDTH / 2;
        rect.H = HEIGHT / 2;
        image.SetFill(rect);

        size.W = WIDTH / 2;
        size.H = HEIGHT / 2;
        image.SetSize(size);
        image.SetVisible(true);

        rect    = image.GetFill();
        rect.Y -= 50;
        rect.W += 100;
        image.SetFill(rect);

        TestMain listener = new TestMain(image);

        // TODO handle key events in order to alter the image like the C
        // example. Meanwhile, just set some w fill
        /* EventListener callback = new EventListener(); */

        /* bg.key_focus_set(true); */
        /* bg.event_callback_priority_add(evas.Callback_Type.Key_down, */
        /*         efl.Callback_Priority.Default, */
        /*         callback, null); */

        loop.Begin();

        efl.All.Shutdown();
    }