EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bx, *ck;
   unsigned int digedit;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("clock", "Clock Example");
   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);

   /* pristine (no seconds, military time) */
   ck = elm_clock_add(win);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   /* am/pm */
   ck = elm_clock_add(win);
   elm_clock_show_am_pm_set(ck, EINA_TRUE);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   /* with seconds and custom time */
   ck = elm_clock_add(win);
   elm_clock_show_seconds_set(ck, EINA_TRUE);
   elm_clock_time_set(ck, 10, 11, 12);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   /* in edition mode, with seconds, custom time and am/pm set */
   ck = elm_clock_add(win);
   elm_clock_edit_set(ck, EINA_TRUE);
   elm_clock_show_seconds_set(ck, EINA_TRUE);
   elm_clock_show_am_pm_set(ck, EINA_TRUE);
   elm_clock_time_set(ck, 10, 11, 12);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   /* in edition mode, with seconds, but only some digits editable */
   ck = elm_clock_add(win);
   elm_clock_show_seconds_set(ck, EINA_TRUE);
   elm_clock_edit_set(ck, EINA_TRUE);
   digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT;
   elm_clock_edit_mode_set(ck, digedit);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}
Esempio n. 2
0
static void
set_api_state(api_data *api)
{
   const Eina_List *items = elm_box_children_get(api->box);
   Evas_Object *ck = eina_list_nth(items, 0);
   if (!eina_list_count(items))
     return;

   /* use elm_box_children_get() to get list of children */
   switch(api->state)
     { /* Put all api-changes under switch */
        case CLOCK_HIDE_SEC:
           elm_clock_show_seconds_set(ck, EINA_FALSE);
           break;

          case CLOCK_SHOW_AM_PM:
           elm_clock_show_am_pm_set(ck,  EINA_TRUE);
           break;

          case CLOCK_SHOW_SEC:
           elm_clock_show_seconds_set(ck, EINA_TRUE);
           break;

          case CLOCK_EDIT_MIN:
           elm_clock_edit_set(ck, ELM_CLOCK_EDIT_MIN_DECIMAL | ELM_CLOCK_EDIT_MIN_UNIT);
           break;

          case CLOCK_EDIT_HOUR:
           elm_clock_edit_set(ck, ELM_CLOCK_EDIT_DEFAULT);
           elm_clock_edit_set(ck, ELM_CLOCK_EDIT_HOUR_DECIMAL | ELM_CLOCK_EDIT_HOUR_UNIT);
           break;

          case CLOCK_EDIT_ALL:
           elm_clock_edit_set(ck, ELM_CLOCK_EDIT_ALL);
           break;

          case CLOCK_EDIT_ALL_ARMY:
           elm_clock_show_am_pm_set(ck,  EINA_FALSE);
           break;

      case API_STATE_LAST:

         break;
      default:
         return;
     }
}
Esempio n. 3
0
SH_API Evas_Object *
create_clock(Evas_Object *parent, Eina_Bool show_seconds, Eina_Bool show_am_pm, const char *time, Eina_Bool is_editable)
{
  Evas_Object *clock;

  clock = elm_clock_add(parent);
  elm_clock_show_seconds_set(clock, show_seconds);
  elm_clock_show_am_pm_set(clock, show_am_pm);
  if (time)
    {
      char **timelist;
      timelist = eina_str_split(time, ",", 3);
      elm_clock_time_set(clock, atoi(timelist[0]), atoi(timelist[1]), atoi(timelist[2]));
      timelist = NULL;
      free(timelist);
    }
  elm_clock_edit_set(clock, is_editable);

  return clock;
}
Esempio n. 4
0
// alarm main window - setup
static void
create_main_win(void)
{
   Evas_Object *win, *bg, *box, *subbox, *toggle, *cloc, *button;
   
   win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
   elm_win_title_set(win, "Set Alarm");
   evas_object_smart_callback_add(win, "delete-request", on_win_del_req, NULL);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, 1.0, 1.0); // expand h/v 1/1 (for win this also fills)
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);
   
   box = elm_box_add(win);
   evas_object_size_hint_weight_set(box, 1.0, 1.0); // expand h/v 1/1 (for win this also fills)
   elm_win_resize_object_add(win, box);
   
   toggle = elm_toggle_add(win);
   elm_toggle_label_set(toggle, "Enabled");
   elm_toggle_states_labels_set(toggle, "ON", "OFF");
   elm_toggle_state_pointer_set(toggle, &(alm.on));   
   evas_object_size_hint_weight_set(toggle, 1.0, 0.0); // expand h/v 1/0
   evas_object_size_hint_align_set(toggle, -1.0, 0.0); // fill h/v 1/0
   elm_box_pack_end(box, toggle);
   evas_object_show(toggle);
   
   cloc = elm_clock_add(win);
   elm_clock_show_am_pm_set(cloc, 1);
   elm_clock_edit_set(cloc, 1);
   elm_clock_time_set(cloc, alm.hours, alm.minutes, 0);
   evas_object_smart_callback_add(cloc, "changed", on_clock_changed, NULL);
   elm_box_pack_end(box, cloc);
   evas_object_show(cloc);
   
   toggle = elm_toggle_add(win);
   elm_toggle_label_set(toggle, "Repeat");
   elm_toggle_states_labels_set(toggle, "ON", "OFF");
   elm_toggle_state_pointer_set(toggle, &(alm.repeat));   
   evas_object_size_hint_weight_set(toggle, 1.0, 0.0); // expand h/v 1/0
   evas_object_size_hint_align_set(toggle, -1.0, 0.0); // fill h/v 1/0
   elm_box_pack_end(box, toggle);
   evas_object_show(toggle);

   cloc = elm_clock_add(win);
   elm_clock_show_am_pm_set(cloc, 1);
   elm_clock_show_seconds_set(cloc, 0);
   elm_box_pack_end(box, cloc);
   evas_object_show(cloc);
   
   button = elm_button_add(win);
   elm_button_label_set(button, "OK");
   evas_object_smart_callback_add(button, "clicked", on_button_activate, NULL);
   evas_object_size_hint_weight_set(button, 1.0, 1.0); // expand h/v 1/0
   evas_object_size_hint_align_set(button, -1.0, 1.0); // fill h/v 1/0, align h/v ?/1.0
   elm_box_pack_end(box, button);
   evas_object_show(button);
   
   evas_object_show(box);
   evas_object_show(win);
}
Esempio n. 5
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *bx, *ck;
   unsigned int digedit;

   win = elm_win_add(NULL, "clock", ELM_WIN_BASIC);
   elm_win_title_set(win, "Clock Example");
   evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);

   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);

   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);

   /* pristine (no seconds, military time) */
   ck = elm_clock_add(win);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   /* am/pm */
   ck = elm_clock_add(win);
   elm_clock_show_am_pm_set(ck, EINA_TRUE);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   /* with seconds and custom time */
   ck = elm_clock_add(win);
   elm_clock_show_seconds_set(ck, EINA_TRUE);
   elm_clock_time_set(ck, 10, 11, 12);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   /* in edition mode, with seconds, custom time and am/pm set */
   ck = elm_clock_add(win);
   elm_clock_edit_set(ck, EINA_TRUE);
   elm_clock_show_seconds_set(ck, EINA_TRUE);
   elm_clock_show_am_pm_set(ck, EINA_TRUE);
   elm_clock_time_set(ck, 10, 11, 12);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   /* in edition mode, with seconds, but only some digits editable */
   ck = elm_clock_add(win);
   elm_clock_show_seconds_set(ck, EINA_TRUE);
   elm_clock_edit_set(ck, EINA_TRUE);
   digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT;
   elm_clock_edit_mode_set(ck, digedit);
   elm_box_pack_end(bx, ck);
   evas_object_show(ck);

   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}