Example #1
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *bt, *bt2, *rect, *rect2, *rect3, *hover;

   win = elm_win_add(NULL, "hover", ELM_WIN_BASIC);
   elm_win_title_set(win, "Hover");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   rect = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_size_hint_min_set(rect, 25, 25);
   evas_object_color_set(rect, 255, 0, 0, 255);
   evas_object_show(rect);

   rect2 = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_size_hint_min_set(rect2, 25, 25);
   evas_object_color_set(rect2, 0, 255, 0, 255);
   evas_object_show(rect2);

   rect3 = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_size_hint_min_set(rect3, 25, 25);
   evas_object_color_set(rect3, 0, 0, 255, 255);
   evas_object_show(rect3);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Show hover");
   evas_object_move(bt, 60, 90);
   evas_object_resize(bt, 80, 20);
   evas_object_show(bt);

   bt2 = elm_button_add(win);
   elm_object_text_set(bt2, "Hide hover");
   evas_object_show(bt2);

   hover = elm_hover_add(win);
   elm_hover_parent_set(hover, win);
   elm_hover_target_set(hover, bt);

   elm_object_style_set(hover, "popout");

   elm_hover_content_set(hover, "left", rect);
   elm_hover_content_set(hover, "top", rect2);
   elm_hover_content_set(hover, "right", rect3);
   elm_hover_content_set(hover, "middle", bt2);

   evas_object_smart_callback_add(bt, "clicked", _show_hover, hover);
   evas_object_smart_callback_add(bt2, "clicked", _hide_hover, hover);

   evas_object_resize(win, 200, 200);
   evas_object_show(win);

   elm_run();

   return 0;
}
Example #2
0
int
main(void)
{
   Evas *canvas;
   Evas_Object *bg, *r1, *r2, *r3;

   ecore_evas_init();

   ee = ecore_evas_buffer_new(WIDTH, HEIGHT);
   if (!ee) goto error;

   canvas = ecore_evas_get(ee);

   bg = evas_object_rectangle_add(canvas);
   evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
   evas_object_move(bg, 0, 0); /* at origin */
   evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
   evas_object_show(bg);

   r1 = evas_object_rectangle_add(canvas);
   evas_object_color_set(r1, 255, 0, 0, 255); /* 100% opaque red */
   evas_object_move(r1, 10, 10);
   evas_object_resize(r1, 100, 100);
   evas_object_show(r1);

   r2 = evas_object_rectangle_add(canvas);
   evas_object_color_set(r2, 0, 128, 0, 128); /* 50% opaque green */
   evas_object_move(r2, 10, 10);
   evas_object_resize(r2, 50, 50);
   evas_object_show(r2);

   r3 = evas_object_rectangle_add(canvas);
   evas_object_color_set(r3, 0, 128, 0, 255); /* 100% opaque dark green */
   evas_object_move(r3, 60, 60);
   evas_object_resize(r3, 50, 50);
   evas_object_show(r3);

   ecore_evas_manual_render(ee);
   _scene_save(canvas, "/tmp/evas-buffer-simple-render.ppm");

   ecore_evas_free(ee);
   ecore_evas_shutdown();

   return 0;

error:
   fprintf(stderr, "error: Requires at least one Evas engine built"
                   " and linked to ecore-evas for this example to run"
                   " properly.\n");
   ecore_evas_shutdown();
   return -1;
}
Example #3
0
static MiniBrowser *browserCreate(const char *url)
{
    MiniBrowser *app = malloc(sizeof(MiniBrowser));

    app->ee = ecore_evas_new(0, 0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT, 0);

    ecore_evas_title_set(app->ee, "EFL MiniBrowser");
    ecore_evas_callback_resize_set(app->ee, on_ecore_evas_resize);
    ecore_evas_borderless_set(app->ee, 0);
    ecore_evas_show(app->ee);

    app->evas = ecore_evas_get(app->ee);

    app->bg = evas_object_rectangle_add(app->evas);
    evas_object_name_set(app->bg, "bg");
    evas_object_size_hint_weight_set(app->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

    evas_object_move(app->bg, 0, 0);
    evas_object_resize(app->bg, DEFAULT_WIDTH, DEFAULT_HEIGHT);
    evas_object_color_set(app->bg, 255, 150, 150, 255);
    evas_object_show(app->bg);

    /* Create webview */
    app->browser = ewk_view_add(app->evas);
    evas_object_name_set(app->browser, "browser");
    evas_object_size_hint_weight_set(app->browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

    evas_object_resize(app->browser, DEFAULT_WIDTH, DEFAULT_HEIGHT);
    evas_object_show(app->browser);
    evas_object_focus_set(app->browser, EINA_TRUE);

    ewk_view_uri_set(app->browser, url);

    return app;
}
Example #4
0
Evas_Object *slideshow_create()
{
    _win = elm_win_add(win, "Slide show", ELM_WIN_BASIC);
    elm_win_autodel_set(_win, 1);
    elm_win_fullscreen_set(_win, 1);

    eyelight_smart = eyelight_object_add(evas_object_evas_get(_win));
    eyelight_object_presentation_file_set(eyelight_smart, eyelight_object_presentation_file_get(pres));
    evas_object_show(eyelight_smart);

    elm_win_resize_object_add(_win, eyelight_smart);

    container= evas_object_rectangle_add(evas_object_evas_get(_win));
    evas_object_color_set(container,0,0,0,0);
    evas_object_event_callback_add(container,EVAS_CALLBACK_KEY_DOWN, _slide_cb, NULL);
    evas_object_event_callback_add(container,EVAS_CALLBACK_MOUSE_MOVE, _mouse_event_cb, NULL);
    evas_object_event_callback_add(container,EVAS_CALLBACK_MOUSE_IN, _mouse_event_cb, NULL);
    evas_object_repeat_events_set(container,1);
    evas_object_show(container);
    elm_win_resize_object_add(_win, container);


    evas_object_raise(container);


    evas_object_show(_win);
    return _win;
}
Example #5
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *o;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("efl-thread-3", "EFL Thread 3");
   elm_win_autodel_set(win, EINA_TRUE);

   o = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_color_set(o, 50, 80, 180, 255);
   evas_object_resize(o, 100, 100);
   evas_object_show(o);
   rect = o;

   // create custom thread to do some "work on the side"
   my_thread_new();

   evas_object_resize(win, 400, 400);
   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *o;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("efl-thread-4", "EFL Thread 4");
   evas_object_smart_callback_add(win, "delete,request", del, NULL);

   o = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_color_set(o, 50, 80, 180, 255);
   evas_object_resize(o, 100, 100);
   evas_object_show(o);
   // new in the examples - we have a mouse down on the blue box cancel
   // the thread
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, down, NULL);
   rect = o;

   // create custom thread to do some "work on the side"
   my_thread_new();

   evas_object_resize(win, 400, 400);
   evas_object_show(win);

   elm_run();
   pthread_mutex_lock(&th_lock);
   th_exit = 1;
   pthread_mutex_unlock(&th_lock);
   elm_shutdown();

   return 0;
}
Example #7
0
/*==========================================================================
 * The two external functions, new and button set
 *========================================================================*/
EAPI Evas_Object *
esmart_draggies_new (Ecore_Evas * ee)
{
  Evas_Object *o = NULL;
  Evas_Object *result = NULL;
  Esmart_Draggies *data = NULL;

  if (!ee)
    return (NULL);
  if ((result = esmart_dragable_object_new (ecore_evas_get (ee))))
    {
       if ((data = evas_object_smart_data_get (result)))
	 {
	    data->ee = ee;
	    o = evas_object_rectangle_add (ecore_evas_get (ee));
	    evas_object_color_set (o, 255, 255, 255, 0);
	    evas_object_repeat_events_set (o, 1);
	    evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN,
		  _mouse_down_cb, data);
	    evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_UP,
		  _mouse_up_cb, data);
	    evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_MOVE,
		  _mouse_move_cb, data);
	    data->obj = o;

	    evas_object_smart_member_add(o, result);
	 }
    }
  return (result);
}
Example #8
0
Evas_Object *elm_lime_image_add(Evas_Object *parent)
{
  grid = elm_grid_add(win);
  clipper = evas_object_rectangle_add(evas_object_evas_get(win));
  
  return grid;
}
Example #9
0
/*==========================================================================
 * The three external functions, new,  button set and type set
 *========================================================================*/
EAPI Evas_Object *
esmart_resize_new(Ecore_Evas * ee)
{
   Evas_Object *o = NULL;
   Evas_Object *result = NULL;
   Esmart_Resize *data = NULL;

   if (!ee)
     return NULL;
   if ((result = esmart_resize_object_new(ecore_evas_get(ee)))
	 && (data = (Esmart_Resize *) evas_object_smart_data_get(result)))
     {
	data->ee = ee;
	o = evas_object_rectangle_add(ecore_evas_get(ee));
	evas_object_color_set(o, 255, 255, 255, 0);
	evas_object_repeat_events_set(o, 1);
	evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
	      _mouse_down_cb, data);
	evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
	      _mouse_up_cb, data);
	evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE,
	      _mouse_move_cb, data);
	data->obj = o;
     }
   return result;
}
Example #10
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *o, *bg;

   win = elm_win_add(NULL, "efl-thread-3", ELM_WIN_BASIC);
   elm_win_title_set(win, "EFL Thread 3");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   evas_object_resize(win, 400, 400);
   evas_object_show(win);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   o = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_color_set(o, 50, 80, 180, 255);
   evas_object_resize(o, 100, 100);
   evas_object_show(o);
   rect = o;

   // create custom thread to do some "work on the side"
   my_thread_new();

   elm_run();
   elm_shutdown();

   return 0;
}
Example #11
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *o;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("efl-thread-5", "EFL Thread 5");
   evas_object_smart_callback_add(win, "delete,request", del, NULL);

   o = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_color_set(o, 50, 80, 180, 255);
   evas_object_resize(o, 100, 100);
   evas_object_show(o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, down, NULL);
   rect = o;

   // explicitly create ecore thread to do some "work on the side" and pass
   // in NULL as data ptr to callbacks and true at the end means to actually
   // make a new thread and not use the thread pool (there is a thread pool
   // with as many thread workers as there are cpu's so this means you do not
   // overload the cpu's with more work than you actually have processing
   // units *IF* your threads do actually spend their time doing actual
   // heavy computation)
   thr = ecore_thread_feedback_run(th_do, th_feedback, th_end, th_cancel,
                                   NULL, EINA_TRUE);

   evas_object_resize(win, 400, 400);
   evas_object_show(win);

   elm_run();
   if (thr) ecore_thread_cancel(thr);

   return 0;
}
Example #12
0
static void
_smart_add(Evas_Object *obj)
{
    Smart_Data *sd;

    /* Initialize smart data and clipping */
    sd = calloc(1, sizeof(Smart_Data));
    if (!sd) return;
    sd->obj = obj;
    sd->parent = NULL;
    sd->children = NULL;
    sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
    evas_object_smart_member_add(sd->clip, obj);
   
    /* Set up edje object and canvas */
    sd->bg = edje_object_add(evas_object_evas_get(obj));
    edje_object_file_set(sd->bg, "../../data/themes/elexika.edj", "result_list");
    evas_object_move(sd->bg, 0, 0);
    evas_object_clip_set(sd->bg, sd->clip);
    evas_object_smart_member_add(sd->bg, obj);
    evas_object_show(sd->bg);

    sd->overlay = edje_object_add(evas_object_evas_get(obj));
    edje_object_file_set(sd->overlay, "../../data/themes/elexika.edj", "overlay");
    evas_object_move(sd->overlay, 0, 0);
    evas_object_clip_set(sd->overlay, sd->clip);
    evas_object_smart_member_add(sd->overlay, obj);
    evas_object_show(sd->overlay);

    evas_object_smart_data_set(obj, sd);
}
Example #13
0
void *
init(Elation_Module *em)
{
   Elation_Module_Private *pr;
   Evas_Coord w, h;
   
   pr = calloc(1, sizeof(Elation_Module_Private));
   if (!pr) return NULL;
   
   /* set up module methods */
   em->shutdown = shutdown;
   em->resize = resize;
   em->show = show;
   em->hide = hide;
   em->focus = focus;
   em->unfocus = unfocus;
   em->action = action;
   
   evas_viewport_get(em->info->evas, NULL, NULL, &w, &h);
   
     {
	Evas_Object *o;
	
	o = evas_object_rectangle_add(em->info->evas);
	pr->key = o;
	
	evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, key_down, em);
     }
     
   return pr;
}
Example #14
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *o, *bg;

   win = elm_win_add(NULL, "efl-thread-4", ELM_WIN_BASIC);
   elm_win_title_set(win, "EFL Thread 4");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   evas_object_resize(win, 400, 400);
   evas_object_show(win);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   o = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_color_set(o, 50, 80, 180, 255);
   evas_object_resize(o, 100, 100);
   evas_object_show(o);
   // new in the examples - we have a mouse down on the blue box cancel
   // the thread
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, down, NULL);
   rect = o;

   // create custom thread to do some "work on the side"
   my_thread_new();

   elm_run();
   elm_shutdown();

   return 0;
}
Example #15
0
int
elm_main(int argc, char **argv)
{
   Evas_Object *o, *bg;
   
   win = elm_win_add(NULL, "efl-thread-2", ELM_WIN_BASIC);
   elm_win_title_set(win, "EFL Thread 2");
   evas_object_resize(win, 400, 400);
   evas_object_show(win);
   
   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);
   
   o = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_color_set(o, 50, 80, 180, 255);
   evas_object_resize(o, 100, 100);
   evas_object_show(o);
   rect = o;
   
   // create custom thread to do some "work on the side"
   my_thread_new();
   
   elm_run();
   return 0;
}
Example #16
0
static void
_smart_add(Evas_Object *obj)
{
    Smart_Data *sd;

    /* Initialize smart data and clipping */
    sd = calloc(1, sizeof(Smart_Data));
    if (!sd) return;
    sd->obj = obj;
    sd->parent = NULL;
    sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
    evas_object_smart_member_add(sd->clip, obj);
   
    /* Set up edje object and canvas */
    sd->edje = edje_object_add(evas_object_evas_get(obj));
    edje_object_file_set(sd->edje, enscribi_theme_find("enscribi"), "enscribi/input");
    evas_object_move(sd->edje, 0, 0);
    evas_object_show(sd->edje);
    sd->canvas = enscribi_canvas_add(evas_object_evas_get(obj));
    edje_object_part_swallow(sd->edje, "canvas", sd->canvas);

    /* Set up callbacks */
    edje_object_signal_callback_add(sd->edje, "canvas,matches,updated", "canvas",
            _enscribi_input_frame_cb_matches, sd);
    edje_object_signal_callback_add(sd->edje, "result,finished", "result",
            _enscribi_input_frame_cb_finished, sd);

    evas_object_smart_data_set(obj, sd);
}
Example #17
0
static void 
e_entry_realize(E_Entry *entry)
{
   char *entries;
   char buf[4096];
   
   entries = e_config_get("entries");
   sprintf(buf, "%s/%s", entries, "base.bits.db");
   entry->obj_base = ebits_load(buf); 
   if (entry->obj_base) 
    {
	ebits_add_to_evas(entry->obj_base, entry->evas);
/*	ebits_set_color_class(entry->obj_base, "Base FG", 100, 200, 255, 255);*/
     }   
   sprintf(buf, "%s/%s", entries, "cursor.bits.db");
   entry->obj_cursor = ebits_load(buf); 
   if (entry->obj_cursor) 
    {
	ebits_add_to_evas(entry->obj_cursor, entry->evas);
/*	ebits_set_color_class(entry->obj_base, "Base FG", 100, 200, 255, 255);*/
     }   
   sprintf(buf, "%s/%s", entries, "selection.bits.db");
   entry->obj_selection = ebits_load(buf); 
   if (entry->obj_selection) 
    {
	ebits_add_to_evas(entry->obj_selection, entry->evas);
/*	ebits_set_color_class(entry->obj_base, "Base FG", 100, 200, 255, 255);*/
     }   
   
   entry->clip_box = evas_object_rectangle_add(entry->evas);
   entry->text = evas_object_text_add(entry->evas);
   evas_object_text_font_set(entry->text, "borzoib", 8);
   evas_object_text_text_set(entry->text, "");
   if (entry->obj_cursor) 
     ebits_set_clip(entry->obj_cursor, entry->clip_box);
   if (entry->obj_selection) 
     ebits_set_clip(entry->obj_selection, entry->clip_box);
   entry->event_box = evas_object_rectangle_add(entry->evas);
   evas_object_color_set(entry->clip_box, 255, 255, 255, 255);
   evas_object_color_set(entry->event_box, 0, 0, 0, 0);
   evas_object_color_set(entry->text, 0, 0, 0, 255);
   evas_object_clip_set(entry->text, entry->clip_box);
   evas_object_clip_set( entry->event_box, entry->clip_box);
   evas_object_event_callback_add(entry->event_box, EVAS_CALLBACK_MOUSE_DOWN, e_entry_down_cb, entry);
   evas_object_event_callback_add(entry->event_box, EVAS_CALLBACK_MOUSE_UP, e_entry_up_cb, entry);
   evas_object_event_callback_add(entry->event_box, EVAS_CALLBACK_MOUSE_MOVE, e_entry_move_cb, entry);
}
Example #18
0
MainContentView::MainContentView(Evas *_e, Evas_Object *_p):
    BaseView(_e, _p),
    EvasSmart(_e, "PageContentView")
{
    clip = evas_object_rectangle_add(evas);
    evas_object_color_set(clip, 255, 255, 255, 255);
    AddMemberObject(clip);
}
Example #19
0
static Evas_Object *
rect_create(Evas *e)
{
   Evas_Object *r;
   r = evas_object_rectangle_add(e);
   evas_object_resize(r, RECT_SIZE, RECT_SIZE);
   evas_object_show(r);
   return r;
}
Example #20
0
Evas_Object *
e_widget_spectrum_add(Evas *evas, E_Color_Component mode, E_Color *cv)
{
    Evas_Object *obj, *o;
    E_Widget_Data *wd;
    Evas_Coord mw, mh;

    obj = e_widget_add(evas);

    e_widget_del_hook_set(obj, _e_wid_del_hook);
    e_widget_focus_hook_set(obj, _e_wid_focus_hook);
    e_widget_disable_hook_set(obj, _e_wid_disable_hook);

    wd = calloc(1, sizeof(E_Widget_Data));
    e_widget_data_set(obj, wd);

    wd->cv = cv;
    wd->mode = mode;

    o = edje_object_add(evas);
    wd->o_edje = o;
    e_theme_edje_object_set(o, "base/theme/widgets",
                            "e/widgets/spectrum");

    evas_object_show(o);
    edje_object_size_min_calc(o, &mw, &mh);
    e_widget_size_min_set(obj, mw, mh);

    e_widget_sub_object_add(obj, o);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
    e_widget_resize_object_set(obj, o);
    evas_object_intercept_resize_callback_add(o, _e_wid_resize, wd);
    evas_object_intercept_move_callback_add(o, _e_wid_move, wd);

    o = e_spectrum_add(evas);
    e_spectrum_color_value_set(o, cv);
    e_spectrum_mode_set(o, mode);
    e_widget_sub_object_add(obj, o);
    evas_object_show(o);
    wd->o_spectrum = o;
    edje_object_part_swallow(wd->o_edje, "e.swallow.content", o);

    o = evas_object_rectangle_add(evas);
    evas_object_repeat_events_set(o, EINA_TRUE);
    evas_object_color_set(o, 0, 0, 0, 0);
    e_widget_sub_object_add(obj, o);
    evas_object_show(o);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_cb_down, obj);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_wid_cb_move, obj);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_wid_cb_up, obj);
    wd->o_event = o;

    e_widget_spectrum_update(obj, 0);

    return obj;
}
Example #21
0
static Evas_Object *
rect_create(void)
{
   Evas_Object *r;
   r = evas_object_rectangle_add(e);
   evas_object_resize(r, 72, 72);
   evas_object_move(r, 25, 350);
   evas_object_show(r);
   return r;
}
/**
 * Creates a new entry widget
 *
 * @param evas the evas where to add the new entry widget
 * @param text_location the location where to store the text of the entry.
 * @param func DOCUMENT ME!
 * @param data  DOCUMENT ME!
 * @param data2 DOCUMENT ME!
 * The current value will be used to initialize the entry
 * @return Returns the new entry widget
 */
EAPI Evas_Object *
e_widget_entry_add(Evas *evas, char **text_location, void (*func)(void *data, void *data2), void *data, void *data2)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord minw, minh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);

   wd = calloc(1, sizeof(E_Widget_Data));
   e_widget_data_set(obj, wd);
   wd->text_location = text_location;

   o = e_entry_add(evas);
   wd->o_entry = o;
   e_widget_sub_object_add(obj, o);
   e_widget_resize_object_set(obj, o);
   evas_object_show(o);

   evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _e_wid_keydown, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _e_wid_movresz, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _e_wid_movresz, obj);

   o = evas_object_rectangle_add(evas);
   wd->o_inout = o;
   evas_object_repeat_events_set(o, EINA_TRUE);
   evas_object_color_set(o, 0, 0, 0, 0);
   e_widget_sub_object_add(obj, o);
   evas_object_smart_member_add(o, obj);
   evas_object_show(o);

   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _e_wid_in, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _e_wid_out, obj);

   o = wd->o_entry;
   if ((text_location) && (*text_location))
     e_entry_text_set(o, *text_location);

   e_entry_size_min_get(o, &minw, &minh);
   e_widget_size_min_set(obj, minw, minh);
   evas_object_size_hint_min_set(obj, minw, minh);

   wd->func = func;
   wd->data = data;
   wd->data2 = data2;
   evas_object_smart_callback_add(o, "changed", _e_wid_changed_cb, obj);

   return obj;
}
static Evas_Object *
rect_create(void)
{
   Evas_Object *r;
   r = evas_object_rectangle_add(e);
   evas_object_color_set(r, 255, 0, 0, 255);
   evas_object_resize(r, 36, 36);
   evas_object_move(r, 25, (450 / 2) - (36 / 2));
   evas_object_show(r);
   return r;
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *cs, *rect, *bx, *fr;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("color selector", "Color selector");
   elm_win_autodel_set(win, EINA_TRUE);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bx);
   evas_object_show(bx);

   fr = elm_frame_add(win);
   evas_object_size_hint_weight_set(fr, 1.0, 0.5);
   evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_object_text_set(fr, "Color View");
   elm_box_pack_end(bx, fr);
   evas_object_show(fr);

   rect = evas_object_rectangle_add(evas_object_evas_get(win));
   elm_object_content_set(fr, rect);
   evas_object_color_set(rect, 255, 90, 18, 255);
   evas_object_show(rect);

   fr = elm_frame_add(win);
   evas_object_size_hint_weight_set(fr, 1.0, 0.5);
   evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_object_text_set(fr, "Color Selector");
   elm_box_pack_end(bx, fr);
   evas_object_show(fr);

   cs = elm_colorselector_add(win);
   elm_colorselector_palette_name_set(cs, "painting");
   evas_object_size_hint_weight_set(cs, EVAS_HINT_EXPAND, 0.0);
   evas_object_size_hint_align_set(cs, EVAS_HINT_FILL, 0.0);
   elm_colorselector_color_set(cs, 255, 90, 18, 255);
   evas_object_show(cs);
   evas_object_smart_callback_add(cs, "changed", _change_color, rect);
   evas_object_smart_callback_add(cs, "color,item,selected", _colorpalette_clicked_cb, rect);
   evas_object_smart_callback_add(cs, "color,item,longpressed", _colorpalette_longpressed_cb, rect);
   elm_object_content_set(fr, cs);

   evas_object_resize(win, 320, 480);
   evas_object_show(win);

   elm_run();

   return 0;
}
static void
optional_ews_setup(void)
{
   Evas_Object *bg;
   Evas *e;

   ecore_evas_ews_setup(0, 0, 800, 600); /* "screen" size */
   e = ecore_evas_ews_evas_get(); /* forces "screen" to be allocated */

   bg = evas_object_rectangle_add(e);
   evas_object_color_set(bg, 128, 32, 32, 255);
   ecore_evas_ews_background_set(bg);
}
Example #26
0
/* Adds a rectangle object to the canvas */
static void _etk_test_canvas_object_add(void *data)
{
   Etk_Canvas *canvas;
   Evas *evas;
   Evas_Object *object;
   Etk_Widget *etk_evas_object;
   int x, y;
   int cw, ch;

   if (!(canvas = ETK_CANVAS(data)) || !(evas = etk_widget_toplevel_evas_get(ETK_WIDGET(canvas))))
      return;

   etk_widget_geometry_get(ETK_WIDGET(canvas), NULL, NULL, &cw, &ch);
   x = rand() % cw;
   y = rand() % ch;

   /* Add a rectangle */
   if (rand() % 4 != 0)
   {
      int w, h;
      int r, g, b, a;

      object = evas_object_rectangle_add(evas);
      w = ETK_MAX(abs(rand() % (cw - x)), 10);
      h = ETK_MAX(abs(rand() % (ch - y)), 10);
      evas_object_resize(object, w, h);

      r = rand() % 255;
      g = rand() % 255;
      b = rand() % 255;
      a = ETK_MAX(rand() % 255, 40);
      evas_color_argb_premul(a, &r, &g, &b);

      evas_object_color_set(object, r, g, b, a);
      etk_evas_object = etk_evas_object_new();
			etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), object);
   }
   /* Or add an image */
   else
   {
      object = evas_object_image_add(evas);
      evas_object_image_file_set(object, PACKAGE_DATA_DIR "/images/test.png", NULL);
      evas_object_image_fill_set(object, 0, 0, 48, 48);
      evas_object_resize(object, 48, 48);
      etk_evas_object = etk_evas_object_new();
      etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), object);
   }

   etk_canvas_put(canvas, etk_evas_object, x, y);
   etk_widget_show_all(etk_evas_object);
}
Example #27
0
int
main(void)
{
   Ecore_Evas *ee;
   Evas_Object *bg, *cursor, *obj;
   int layer, x, y;

   ecore_evas_init();

   ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL);
   ecore_evas_title_set(ee, "Ecore Evas Object Example");
   ecore_evas_show(ee);

   bg = evas_object_rectangle_add(ecore_evas_get(ee));
   evas_object_color_set(bg, 0, 0, 255, 255);
   evas_object_resize(bg, 200, 200);
   evas_object_show(bg);
   ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);

   if (bg == ecore_evas_object_associate_get(ee))
     printf("Association worked!\n");

   cursor = evas_object_rectangle_add(ecore_evas_get(ee));
   evas_object_color_set(cursor, 0, 255, 0, 255);
   evas_object_resize(cursor, 5, 10);
   ecore_evas_object_cursor_set(ee, cursor, 0, 1, 1);

   ecore_evas_cursor_get(ee, &obj, &layer, &x, &y);
   if (obj == cursor && layer == 0 && x == 1 && y == 1)
     printf("Set cursor worked!\n");

   ecore_main_loop_begin();

   ecore_evas_free(ee);
   ecore_evas_shutdown();

   return 0;
}
Example #28
0
void etk_test_evas_object_window_create(void *data)
{
	Evas *evas;
	Evas_Object *edje_object;
	Evas_Object *evas_object;
	static Etk_Widget *window = NULL;
	Etk_Widget *vbox;
	Etk_Widget *frame;
	Etk_Widget *etk_evas_object;
	int w, h;

	if (window)
	{
		etk_widget_show_all(window);
		return;
	}

	window = etk_window_new();
  etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(window), ETK_CALLBACK(etk_window_hide_on_delete), NULL);
	etk_window_title_set(ETK_WINDOW(window), "Etk-Evas Object Test");

	evas = etk_toplevel_evas_get(ETK_TOPLEVEL(window));

	vbox = etk_vbox_new(ETK_FALSE, 5);

	/* Add an edje object */
	frame = etk_frame_new("Edje Object");
	edje_object = edje_object_add(evas);
	edje_object_file_set(edje_object, PACKAGE_DATA_DIR"/test/clock.edj", "icon"); 
	edje_object_size_min_get(edje_object, &w, &h);
	edje_extern_object_min_size_set(edje_object, w, h);
	evas_object_resize(edje_object, w, h);
	etk_evas_object = etk_evas_object_new();
	etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), edje_object);
	etk_container_add(ETK_CONTAINER(frame), etk_evas_object);
	etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

	/* Add an evas rectangle */
	frame = etk_frame_new("Evas Object");
	evas_object = evas_object_rectangle_add(evas);
	evas_object_resize(evas_object, 150, 150);
	evas_object_color_set(evas_object, 150, 100, 100, 255);
	etk_evas_object = etk_evas_object_new();
	etk_evas_object_set_object(ETK_EVAS_OBJECT(etk_evas_object), evas_object);
	etk_container_add(ETK_CONTAINER(frame), etk_evas_object);
	etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_END, ETK_BOX_EXPAND_FILL, 0);

	etk_container_add(ETK_CONTAINER(window), vbox);
	etk_widget_show_all(window);
}
Example #29
0
CalaosCameraView::CalaosCameraView(Evas *evas):
    EvasSmart(evas, "PageContentView")
{
    clip = evas_object_rectangle_add(evas);
    evas_object_color_set(clip, 255, 255, 255, 255);
    AddMemberObject(clip);

    camImage = evas_object_image_add(evas);
    evas_object_clip_set(camImage, clip);
    AddMemberObject(camImage);

    handler_data = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _url_data_cb, this);
    handler_complete = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_complete_cb, this);
}
Example #30
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *bubble, *label, *icon;

   win = elm_win_add(NULL, "bubble", ELM_WIN_BASIC);
   elm_win_title_set(win, "Bubble");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   evas_object_resize(win, 300, 200);
   evas_object_show(win);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   label = elm_label_add(win);
   elm_object_text_set(label, "This is the CONTENT of our bubble");
   evas_object_show(label);

   icon = evas_object_rectangle_add(evas_object_evas_get(win));
   evas_object_color_set(icon, 0, 0, 255, 255);
   evas_object_show(icon);

   bubble = elm_bubble_add(win);
   elm_object_part_content_set(bubble, "icon", icon);
   elm_object_part_text_set(bubble, "info", "INFO");
   elm_object_text_set(bubble, "LABEL");
   elm_object_content_set(bubble, label);
   evas_object_resize(bubble, 300, 100);
   evas_object_show(bubble);

   evas_object_smart_callback_add(bubble, "clicked", _bla, NULL);

   label = elm_label_add(win);
   elm_object_text_set(label, "Bubble with no icon, info or label");
   evas_object_show(label);

   bubble = elm_bubble_add(win);
   elm_object_content_set(bubble, label);
   evas_object_resize(bubble, 200, 50);
   evas_object_move(bubble, 0, 110);
   evas_object_show(bubble);

   elm_run();
   elm_shutdown();

   return 0;
}