コード例 #1
0
static void
set_api_state(api_data *api)
{
   const Eina_List *items = elm_box_children_get(api->box);
   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 BOX_PACK_START:  /* Move last item to begining */
         elm_box_unpack(api->box, eina_list_data_get(eina_list_last(items)));
         elm_box_pack_start(api->box, eina_list_data_get(eina_list_last(items)));
         break;

      case BOX_PACK_BEFORE:
         if (eina_list_count(items) > 1)
               {  /* Put last item before the one preceeding it */
                  elm_box_unpack(api->box, eina_list_data_get(eina_list_last(items)));
                  elm_box_pack_before(api->box,
                        eina_list_data_get(eina_list_last(items)),
                        eina_list_nth(items, eina_list_count(items)-2));
               }
         break;

      case BOX_PACK_AFTER:
         if (eina_list_count(items) > 1)
               {  /* Put item before last to last */
                  elm_box_unpack(api->box, eina_list_nth(items,
                           eina_list_count(items)-2));
                  elm_box_pack_after(api->box,
                        eina_list_nth(items, eina_list_count(items)-2),
                        eina_list_data_get(eina_list_last(items)));
               }
         break;

      case BOX_PADDING_SET:
         elm_box_padding_set(api->box, 30, 15);
         break;

      case BOX_ALIGN_SET:
         elm_box_align_set(api->box, 0.25, 0.75);
         break;

      case BOX_HOMOGENEOUS_SET:
         elm_box_homogeneous_set(api->box, EINA_TRUE);
         break;

      case BOX_UNPACK_ALL:
           {
              Eina_List *l;
              Evas_Object *data;
              elm_box_unpack_all(api->box);
              EINA_LIST_REVERSE_FOREACH(items, l, data)
                 elm_box_pack_end(api->box, data);
           }
         break;

      case BOX_CLEAR:
         elm_box_clear(api->box);
         break;

      case API_STATE_LAST:

         break;
      default:
         return;
     }
}
コード例 #2
0
ファイル: connection.c プロジェクト: kcassia/pHClient
void create_second_page(void *data, Evas_Object *connect_button, void *ev) {


   struct appdata *ad = data;
   Elm_Object_Item *nf_it = NULL;

   Evas_Object *layout = elm_layout_add(ad->naviframe);

   // Outer Box
   Evas_Object* box = elm_box_add(layout);
   evas_object_size_hint_weight_set(box, EVAS_HINT_FILL, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_align_set(box, 0.5, 0.5);

   // Port Box
   Evas_Object* box2 = elm_box_add(layout);
   elm_box_horizontal_set(box2, EINA_TRUE);

   // Port Label
   Evas_Object* portLabel = elm_label_add(box);
   elm_object_text_set(portLabel, "<align = center>Port </align>");
   elm_box_pack_end(box2, portLabel);
   evas_object_show(portLabel);

   // Port Entry
   portEntry = elm_entry_add(box2);
   elm_entry_entry_set(portEntry, "7777");
   elm_entry_single_line_set(portEntry, EINA_FALSE);
   elm_entry_line_wrap_set(portEntry, ELM_WRAP_NONE);
   static Elm_Entry_Filter_Limit_Size portLimit_size = { .max_char_count = 5,
.max_byte_count = 0 };
   elm_entry_markup_filter_append(portEntry, elm_entry_filter_limit_size,
         &portLimit_size);
   elm_box_pack_end(box2, portEntry);
   evas_object_show(portEntry);

   evas_object_show(box2);
   evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, 0.3);
   evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(box, box2);

   // IP Box
   Evas_Object* box1 = elm_box_add(layout);
   elm_box_horizontal_set(box1, EINA_TRUE);

   // IP Label
   Evas_Object* ipLabel = elm_label_add(box1);
   elm_object_text_set(ipLabel, "<align = center>IP </align>");
   elm_box_pack_end(box1, ipLabel);
   evas_object_show(ipLabel);

   static Elm_Entry_Filter_Limit_Size ipLimit_size = { .max_char_count = 3, // 3글자 까지
         .max_byte_count = 0 };

   // IP Entry
   ipEntry1 = elm_entry_add(box1);
   //elm_entry_entry_set(ipEntry1, "127");
   elm_entry_single_line_set(ipEntry1, EINA_FALSE);
   elm_entry_line_wrap_set(ipEntry1, ELM_WRAP_NONE);
   elm_entry_markup_filter_append(ipEntry1, elm_entry_filter_limit_size,
         &ipLimit_size);
   elm_box_pack_end(box1, ipEntry1);
   evas_object_show(ipEntry1);

   // IP Label
   Evas_Object* ipPeriod1 = elm_label_add(box1);
   elm_object_text_set(ipPeriod1, "<align = center>.</align>");
   elm_box_pack_end(box1, ipPeriod1);
   evas_object_show(ipPeriod1);

   // IP Entry
   ipEntry2 = elm_entry_add(box1);
   //elm_entry_entry_set(ipEntry2, "  0");
   elm_entry_single_line_set(ipEntry2, EINA_FALSE);
   elm_entry_line_wrap_set(ipEntry2, ELM_WRAP_NONE);
   elm_entry_markup_filter_append(ipEntry2, elm_entry_filter_limit_size,
         &ipLimit_size);
   elm_box_pack_end(box1, ipEntry2);
   evas_object_show(ipEntry2);

   // IP Label
   Evas_Object* ipPeriod2 = elm_label_add(box1);
   elm_object_text_set(ipPeriod2, "<align = center>.</align>");
   elm_box_pack_end(box1, ipPeriod2);
   evas_object_show(ipPeriod2);

   // IP Entry
   ipEntry3 = elm_entry_add(box1);
   //elm_entry_entry_set(ipEntry3, "  0");
   elm_entry_single_line_set(ipEntry3, EINA_FALSE);
   elm_entry_line_wrap_set(ipEntry3, ELM_WRAP_NONE);
   elm_entry_markup_filter_append(ipEntry3, elm_entry_filter_limit_size,
         &ipLimit_size);
   elm_box_pack_end(box1, ipEntry3);
   evas_object_show(ipEntry3);

   // IP Label
   Evas_Object* ipPeriod3 = elm_label_add(box1);
   elm_object_text_set(ipPeriod3, "<align = center>.</align>");
   elm_box_pack_end(box1, ipPeriod3);
   evas_object_show(ipPeriod3);

   // IP Entry
   ipEntry4 = elm_entry_add(box1);
   //elm_entry_entry_set(ipEntry4, "  1");
   elm_entry_single_line_set(ipEntry4, EINA_FALSE);
   elm_entry_line_wrap_set(ipEntry4, ELM_WRAP_NONE);
   elm_entry_markup_filter_append(ipEntry4, elm_entry_filter_limit_size,
         &ipLimit_size);
   elm_box_pack_end(box1, ipEntry4);
   evas_object_show(ipEntry4);

   evas_object_show(box1);
   evas_object_size_hint_weight_set(box1, EVAS_HINT_EXPAND, 0.3);
   evas_object_size_hint_align_set(box1, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(box, box1);

   // Connect Button
   Evas_Object* connection_button = elm_button_add(box);
   elm_object_style_set(connection_button, "bottom");
   elm_object_text_set(connection_button, "Connection");
   elm_object_part_content_set(layout, "elm.swallow.button", connection_button);
   //evas_object_size_hint_weight_set(connection_button, EVAS_HINT_EXPAND, 1.0);
   evas_object_size_hint_align_set(connection_button, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_smart_callback_add(connection_button, "clicked", _connect_button_click_cb, NULL);
   elm_box_pack_end(box, connection_button);

   evas_object_show(connection_button);

   evas_object_show(box);

   elm_entry_input_panel_layout_set(ipEntry1,ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
   elm_entry_input_panel_layout_set(ipEntry2,ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
   elm_entry_input_panel_layout_set(ipEntry3,ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
   elm_entry_input_panel_layout_set(ipEntry4,ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
   elm_entry_input_panel_layout_set(portEntry,ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);

   nf_it = elm_naviframe_item_push(ad->naviframe,"<color=#F5D6FFFF>Connection</color>", NULL, NULL, box, NULL);

//   evas_object_show(ad->win);
}
コード例 #3
0
ファイル: em_gui.c プロジェクト: 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;
}
コード例 #4
0
ファイル: box.cpp プロジェクト: voivoid/EflCpp
void Box::setAlign(double hor, double vert)
{
    elm_box_align_set(getHandle(), hor, vert);
}