Hey

I just committed the textgrid object, which will be used in
terminology and maybe a couple of other apps. It needs love, though,
as I'm not a text master in Evas.

I've attached a test example, which should give that :

http://www.maths.univ-evry.fr/pages_perso/vtorri/files/textgrid.png

Vincent
/* gcc -g -Wall -o evas_textgrid evas_textgrid.c `pkg-config --cflags --libs ecore-evas ecore evas eina` */

#include <Eina.h>
#include <Evas.h>
#include <Ecore.h>
#include <Ecore_Evas.h>

static void
_delete_request_cb(Ecore_Evas *ee)
{
  ecore_main_loop_quit();
}

static void
_key_up_cb(void *data, Evas *e, Evas_Object *o, void *event_info)
{
  Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *)event_info;

  if (strcmp(ev->keyname, "q") == 0)
    {
      ecore_main_loop_quit();
    }
}

int main()
{
  Ecore_Evas *ee;
  Evas *evas;
  Evas_Object *o;
  Evas_Object *bg;
  Evas_Textgrid_Cell cells[3];
  int w, h;

  if (!ecore_evas_init())
    return -1;

  ee = ecore_evas_new(NULL, 10, 10, 1, 1, NULL);
  if (!ee)
    goto shutdown_ecore_evas;
  ecore_evas_callback_delete_request_set(ee, _delete_request_cb);
  ecore_evas_title_set(ee, "Evas Textgrid test");

  evas = ecore_evas_get(ee);

  o = evas_object_rectangle_add(evas);
  evas_object_color_set(o, 255, 255, 255, 255);
  evas_object_move(o, 0, 0);
  evas_object_show(o);
  bg = o;

  memset(cells, 0, sizeof(cells));
  cells[0].codepoint = 'a';
  cells[0].fg = 0;
  cells[0].bg = 3;
  cells[1].codepoint = 'b';
  cells[1].fg = 1;
  cells[1].bg = 0;
  cells[1].underline = 1;
  cells[2].codepoint = 'c';
  cells[2].fg = 0;
  cells[2].bg = 4;
  cells[2].strikethrough = 1;

  o = evas_object_textgrid_add(evas);
  evas_object_textgrid_size_set(o, 3, 3);
  evas_object_textgrid_font_source_set(o, "/usr/share/fonts/truetype/ttf-dejavu");
  evas_object_textgrid_font_set(o, "Serif", 12);
  evas_object_textgrid_cell_size_get(o, &w, &h);
  printf(" ** size : %dx%d\n", w, h);
  evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, 0, 0, 0, 0, 255);
  evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, 1, 255, 0, 0, 255);
  evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, 2, 0, 255, 0, 255);
  evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, 3, 0, 0, 255, 255);
  evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, 4, 0, 255, 255, 255);
  evas_object_textgrid_cellrow_set(o, 0, cells);
  evas_object_move(o, 0,0);
  evas_object_resize(o, w*3, h*3);
  evas_object_show(o);

  evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_UP, _key_up_cb, NULL);
  evas_object_focus_set(o, EINA_TRUE);

  evas_object_resize(bg, w*3, h*3);
  ecore_evas_resize(ee, w*3, h*3);
  ecore_evas_show(ee);

  ecore_main_loop_begin();

  ecore_evas_shutdown();

  return 0;

 shutdown_ecore_evas:
  ecore_evas_shutdown();

  return -1;
}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to