Calendar - Simple creation.

As a first example, let's just display a calendar in our window, explaining all steps required to do so.

First you should declare objects we intend to use:

   Evas_Object *win, *bg, *cal;

Then a window is created, a title is set and its set to be autodeleted. More details can be found on windows examples:

   win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC);
   elm_win_title_set(win, "Calendar Creation Example");
   elm_win_autodel_set(win, EINA_TRUE);

Next a simple background is placed on our windows. More details on elm_bg - Plain color background. :

   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_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

Now, the exciting part, let's add the calendar with elm_calendar_add(), passing our window object as parent.

   cal = elm_calendar_add(win);
   elm_win_resize_object_add(win, cal);
   evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(cal);

To conclude our example, we should show the window and run elm mainloop:

   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}
ELM_MAIN()

Our example will look like this:

calendar_example_01.png

See the full source code calendar_example_01::c here.