Exemplo n.º 1
0
Arquivo: em_gui.c Projeto: Limsik/e17
/* public functions */
EM_INTERN Eina_Bool
em_gui_init(void)
{
   Evas_Object *o, *oo;

   /* allocate our object */
   gui = EM_OBJECT_ALLOC(Em_Gui, EM_GUI_TYPE, _em_gui_cb_free);
   if (!gui) return EINA_FALSE;

   /* create window */
   gui->w_win = elm_win_add(NULL, "emote", ELM_WIN_BASIC);
   elm_win_title_set(gui->w_win, "Emote");
   elm_win_keyboard_mode_set(gui->w_win, ELM_WIN_KEYBOARD_ALPHA);
   evas_object_smart_callback_add(gui->w_win, "delete,request",
                                  _em_gui_cb_win_del, NULL);

   /* create background */
   o = elm_bg_add(gui->w_win);
   evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(gui->w_win, o);
   evas_object_show(o);

   o = elm_box_add(gui->w_win);
   elm_box_homogeneous_set(o, EINA_FALSE);
   elm_win_resize_object_add(gui->w_win, o);
   evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_box_align_set(o, 0.5, 0.5);
   evas_object_show(o);

   /* create main toolbar */
   gui->w_tb = elm_toolbar_add(gui->w_win);
   elm_toolbar_icon_size_set(gui->w_tb, (8 * elm_config_scale_get()));
   elm_toolbar_align_set(gui->w_tb, 1.0);
   elm_toolbar_shrink_mode_set(gui->w_tb, ELM_TOOLBAR_SHRINK_SCROLL);
   elm_toolbar_item_append(gui->w_tb, "preferences-system", _("Settings"),
                        _em_gui_cb_settings, NULL);
   elm_toolbar_item_append(gui->w_tb, "application-exit", _("Quit"),
                        _em_gui_cb_quit, NULL);
   evas_object_size_hint_weight_set(gui->w_tb, EVAS_HINT_EXPAND, 0.0);
   evas_object_size_hint_align_set(gui->w_tb, EVAS_HINT_FILL, 0.0);
   evas_object_show(gui->w_tb);
   elm_box_pack_start(o, gui->w_tb);

   /* create packing box */
   gui->w_box = elm_panes_add(gui->w_win);
   elm_panes_fixed_set(gui->w_box, EINA_FALSE);
   elm_panes_horizontal_set(gui->w_box, EINA_FALSE);
   elm_panes_content_left_size_set(gui->w_box, 0.20);
   evas_object_size_hint_weight_set(gui->w_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(gui->w_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(o, gui->w_box);
   evas_object_show(gui->w_box);

   gui->w_chansel_itc = elm_genlist_item_class_new();
   gui->w_chansel_itc->item_style = "default";
   gui->w_chansel_itc->func.text_get = _em_gui_chansel_cb_label_get;
   gui->w_chansel_itc->func.content_get = NULL;
   gui->w_chansel_itc->func.state_get = NULL;
   gui->w_chansel_itc->func.del = NULL;

   /* create channel selector w/ frame */
   gui->w_chansel = elm_genlist_add(gui->w_win);
   elm_genlist_mode_set(gui->w_chansel, ELM_LIST_SCROLL);
   evas_object_size_hint_min_set(gui->w_chansel, 200, MIN_WIN_HEIGHT);
   evas_object_size_hint_weight_set(gui->w_chansel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(gui->w_chansel);

   o = elm_frame_add(gui->w_win);
   elm_object_part_text_set(o, "default", "Channels");
   oo = elm_frame_add(gui->w_win);
   elm_object_style_set(oo, "pad_small");
   elm_object_part_content_set(o, "default", oo);
   elm_object_part_content_set(oo, "default", gui->w_chansel);
   elm_object_part_content_set(gui->w_box, "left", o);
   evas_object_show(oo);
   evas_object_show(o);

   /* set min size of window and show it */
   evas_object_show(gui->w_win);
   evas_object_resize(gui->w_win, MIN_WIN_WIDTH, MIN_WIN_HEIGHT);

   gui->servers = eina_hash_string_small_new(_em_gui_server_del);

   return EINA_TRUE;
}
Exemplo n.º 2
0
/* public functions */
EM_INTERN Eina_Bool 
em_gui_init(void)
{
   Evas_Object *o;

   /* allocate our object */
   gui = EM_OBJECT_ALLOC(Em_Gui, EM_GUI_TYPE, _em_gui_cb_free);
   if (!gui) return EINA_FALSE;

   // Set finger size to 4 to avoid huge widgets
//   elm_finger_size_set(4);

   /* create window */
   gui->w_win = elm_win_add(NULL, "emote", ELM_WIN_BASIC);
   elm_win_title_set(gui->w_win, "Emote");
   elm_win_keyboard_mode_set(gui->w_win, ELM_WIN_KEYBOARD_ALPHA);
   evas_object_smart_callback_add(gui->w_win, "delete-request",
                                  _em_gui_cb_win_del, NULL);

   /* create background */
   o = elm_bg_add(gui->w_win);
   evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
//   evas_object_size_hint_min_set(o, MIN_WIN_WIDTH, MIN_WIN_HEIGHT);
   elm_win_resize_object_add(gui->w_win, o);
   evas_object_show(o);

   /* create packing box */
   gui->w_box = elm_box_add(gui->w_win);
   elm_win_resize_object_add(gui->w_win, gui->w_box);
   evas_object_size_hint_weight_set(gui->w_box, EVAS_HINT_EXPAND, 
                                    EVAS_HINT_EXPAND);
   evas_object_show(gui->w_box);

   /* create main toolbar */
   gui->w_tb = elm_toolbar_add(gui->w_win);
   elm_toolbar_icon_size_set(gui->w_tb, (16 * elm_scale_get()));
   elm_toolbar_align_set(gui->w_tb, 0.0);
   elm_toolbar_mode_shrink_set(gui->w_tb, ELM_TOOLBAR_SHRINK_SCROLL);
   evas_object_size_hint_weight_set(gui->w_tb, 0.0, 0.0);
   evas_object_size_hint_align_set(gui->w_tb, EVAS_HINT_FILL, 0.0);

   elm_toolbar_item_append(gui->w_tb, "preferences-system", _("Settings"), 
                        _em_gui_cb_settings, NULL);
   elm_toolbar_item_append(gui->w_tb, "application-exit", _("Quit"), 
                        _em_gui_cb_quit, NULL);
   evas_object_show(gui->w_tb);
   elm_box_pack_start(gui->w_box, gui->w_tb);

   /* create channel selector */
   gui->w_chansel = elm_toolbar_add(gui->w_win);
   elm_toolbar_homogeneous_set(gui->w_chansel, EINA_FALSE);
   elm_toolbar_align_set(gui->w_chansel, 0.0);
   elm_toolbar_mode_shrink_set(gui->w_chansel, ELM_TOOLBAR_SHRINK_SCROLL);
   evas_object_size_hint_weight_set(gui->w_chansel, 0.0, 0.0);
   evas_object_size_hint_align_set(gui->w_chansel, EVAS_HINT_FILL, 0.0);
   evas_object_show(gui->w_chansel);
   elm_box_pack_end(gui->w_box, gui->w_chansel);

   /* set min size of window and show it */
//   evas_object_size_hint_min_set(gui->w_win, MIN_WIN_WIDTH, MIN_WIN_HEIGHT);
   evas_object_resize(gui->w_win, MIN_WIN_WIDTH, MIN_WIN_HEIGHT);
   evas_object_show(gui->w_win);

   gui->servers = eina_hash_string_small_new(_em_gui_server_del);

   return EINA_TRUE;
}