diff --git a/legacy/elementary/src/bin/test.c b/legacy/elementary/src/bin/test.c index c264ee08a6..1ec7323699 100644 --- a/legacy/elementary/src/bin/test.c +++ b/legacy/elementary/src/bin/test.c @@ -733,8 +733,7 @@ my_bt_13(void *data, Evas_Object *obj, void *event_info) elm_box_pack_end(bx, bx2); evas_object_show(bx2); - // FIXME: not exported - elm_widget_focus_set(win, 1); + elm_object_focus(win); evas_object_show(win); } @@ -854,8 +853,7 @@ my_bt_14(void *data, Evas_Object *obj, void *event_info) evas_object_resize(win, 320, 300); - // FIXME: not exported - elm_widget_focus_set(win, 1); + elm_object_focus(win); evas_object_show(win); } @@ -951,8 +949,7 @@ my_bt_15(void *data, Evas_Object *obj, void *event_info) evas_object_resize(win, 320, 300); - // FIXME: not exported - elm_widget_focus_set(win, 1); + elm_object_focus(win); evas_object_show(win); } @@ -1056,8 +1053,7 @@ my_bt_16(void *data, Evas_Object *obj, void *event_info) evas_object_resize(win, 320, 300); - // FIXME: not exported - elm_widget_focus_set(win, 1); + elm_object_focus(win); evas_object_show(win); } @@ -1242,8 +1238,7 @@ my_bt_17(void *data, Evas_Object *obj, void *event_info) evas_object_resize(win, 320, 300); - // FIXME: not exported - elm_widget_focus_set(win, 1); + elm_object_focus(win); evas_object_show(win); } @@ -1769,264 +1764,306 @@ my_bt_23(void *data, Evas_Object *obj, void *event_info) evas_object_show(win); } +static void +my_bt_24(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *inwin, *lb; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "inwin", ELM_WIN_BASIC); + elm_win_title_set(win, "Inwin"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + inwin = elm_win_inwin_add(win); + evas_object_show(inwin); + + lb = elm_label_add(win); + elm_label_label_set(lb, + "This is an \"inwin\" - a window in a
" + "window. This is handy for quick popups
" + "you want centered, taking over the window
" + "until dismissed somehow. Unlike hovers they
" + "don't hover over their target."); + elm_win_inwin_content_set(inwin, lb); + evas_object_show(lb); + + evas_object_resize(win, 320, 240); + evas_object_show(win); +} + +static void +my_bt_25(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *inwin, *lb; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "inwin", ELM_WIN_BASIC); + elm_win_title_set(win, "Inwin"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + inwin = elm_win_inwin_add(win); + elm_win_inwin_style_set(inwin, "minimal_vertical"); + evas_object_show(inwin); + + lb = elm_label_add(win); + elm_label_label_set(lb, + "This is an \"inwin\" - a window in a
" + "window. This is handy for quick popups
" + "you want centered, taking over the window
" + "until dismissed somehow. Unlike hovers they
" + "don't hover over their target.
" + "
" + "This inwin style compacts itself vertically
" + "to the size of its contents minimum size."); + elm_win_inwin_content_set(inwin, lb); + evas_object_show(lb); + + evas_object_resize(win, 320, 240); + evas_object_show(win); +} + +static void +my_bt_26(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *bx, *bt; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "scaling", ELM_WIN_BASIC); + elm_win_title_set(win, "Scaling"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, 1.0, 1.0); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Scale: 0.5"); + elm_object_scale_set(bt, 0.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Scale: 0.75"); + elm_object_scale_set(bt, 0.75); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Scale: 1.0"); + elm_object_scale_set(bt, 1.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Scale: 1.5"); + elm_object_scale_set(bt, 1.5); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Scale: 2.0"); + elm_object_scale_set(bt, 2.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Scale: 3.0"); + elm_object_scale_set(bt, 3.0); + elm_box_pack_end(bx, bt); + evas_object_show(bt); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + +static void +my_bt_27(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *bx, *fr, *lb; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "scaling", ELM_WIN_BASIC); + elm_win_title_set(win, "Scaling"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, 1.0, 1.0); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + fr = elm_frame_add(win); + elm_object_scale_set(fr, 0.5); + elm_frame_label_set(fr, "Scale: 0.5"); + lb = elm_label_add(win); + elm_label_label_set(lb, + "Parent frame scale
" + "is 0.5. Child should
" + "inherit it."); + elm_frame_content_set(fr, lb); + evas_object_show(lb); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + fr = elm_frame_add(win); + elm_frame_label_set(fr, "Scale: 1.0"); + lb = elm_label_add(win); + elm_label_label_set(lb, + "Parent frame scale
" + "is 1.0. Child should
" + "inherit it."); + elm_frame_content_set(fr, lb); + evas_object_show(lb); + elm_object_scale_set(fr, 1.0); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + fr = elm_frame_add(win); + elm_frame_label_set(fr, "Scale: 2.0"); + lb = elm_label_add(win); + elm_label_label_set(lb, + "Parent frame scale
" + "is 2.0. Child should
" + "inherit it."); + elm_frame_content_set(fr, lb); + evas_object_show(lb); + elm_object_scale_set(fr, 2.0); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} + static void my_win_main(void) { - Evas_Object *win, *bg, *bx0, *lb, *bx, *bt, *sc, *fr; + Evas_Object *win, *bg, *bx0, *lb, *li, *fr; - /* 1 create an elm window - it returns an evas object. this is a little - * special as the object lives in the canvas that is inside the window - * so what is returned is really inside the window, but as you manipulate - * the evas object returned - the window will respond. elm_win makes sure - * of that so you can blindly treat it like any other evas object - * pretty much, just as long as you know it has special significance */ - /* the first parameter is a "parent" window - eg for a dialog you want to - * have a main window it is related to, here it is NULL meaning there - * is no parent. "main" is the name of the window - used by the window - * manager for identifying the window uniquely amongst all the windows - * within this application (and all instances of the application). the - * type is a basic window (the final parameter) */ - win = elm_win_add(NULL, "main", ELM_WIN_BASIC); - /* set the title of the window - this is in the titlebar */ - elm_win_title_set(win, "Elementary Tests"); - - /* set a callback on the window when "delete-request" is emitted as - * a callback. when this happens my_win_del() is called and the - * data pointer (first param) is passed the final param here (in this - * case it is NULL). This is how you can pass specific things to a - * callback like objects or data layered on top */ - evas_object_smart_callback_add(win, "delete-request", my_win_del, NULL); - - /* add a background to our window. this just uses the standard theme set - * background. without a backgorund, you could make a window seem - * transparent with elm_win_alpha_set(win, 1); for example. if you have - * a compositor running this will make the window able to be - * semi-transparent and any space not filled by object/widget pixels will - * be transparent or translucent based on alpha. if you do not have a - * comnpositor running this should fall back to using shaped windows - * (which have a mask). both these features will be slow and rely on - * a lot more resources, so only use it if you need it. */ - bg = elm_bg_add(win); - /* set weight to 1.0 x 1.0 == expand in both x and y direction */ - evas_object_size_hint_weight_set(bg, 1.0, 1.0); - /* tell the window that this object is to be resized along with the window. - * also as a result this object will be one of several objects that - * controls the minimum/maximum size of the window */ - elm_win_resize_object_add(win, bg); - /* and show the background */ - evas_object_show(bg); - - /* add a box layout widget to the window */ - bx0 = elm_box_add(win); - /* allow base box (bx0) to expand in x and y */ - evas_object_size_hint_weight_set(bx0, 1.0, 1.0); - /* tell the window that the box affects window size and also will be - * resized when the window is */ - elm_win_resize_object_add(win, bx0); - evas_object_show(bx0); - - fr = elm_frame_add(win); - elm_frame_label_set(fr, "Information"); - elm_box_pack_end(bx0, fr); - evas_object_show(fr); - - lb = elm_label_add(win); - elm_label_label_set(lb, - "Please slect a test from the list below
" - "by clicking the test button to show the
" - "test window."); - elm_frame_content_set(fr, lb); - evas_object_show(lb); - - /* add a scroller object - anything inside is scrollable */ - sc = elm_scroller_add(win); - /* add scroller to main box */ - evas_object_size_hint_weight_set(sc, 1.0, 1.0); - evas_object_size_hint_align_set(sc, -1.0, -1.0); - elm_box_pack_end(bx0, sc); - evas_object_show(sc); - - /* add a box layout widget to the window */ - bx = elm_box_add(win); - /* set weight to 1.0 x 0.0 == expand in x and not in y) */ - evas_object_size_hint_weight_set(bx, 1.0, 0.0); - - /* set the box ad the content in the scrolled view*/ - elm_scroller_content_set(sc, bx); - /* show the box, scroller and main box */ - evas_object_show(bx); - - /* create a button */ - bt = elm_button_add(win); - /* set the button label */ - elm_button_label_set(bt, "Bg Plain"); - /* add a callback to be run when the button is clicked */ - evas_object_smart_callback_add(bt, "clicked", my_bt_1, NULL); - /* the button should fill any space it is given horizontally */ - evas_object_size_hint_align_set(bt, -1.0, 0.0); - /* put the button at the end of the box */ - elm_box_pack_end(bx, bt); - /* show the button */ - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Bg Image"); - evas_object_smart_callback_add(bt, "clicked", my_bt_2, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Icon Transparent"); - evas_object_smart_callback_add(bt, "clicked", my_bt_3, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Box Vert"); - evas_object_smart_callback_add(bt, "clicked", my_bt_4, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Box Horiz"); - evas_object_smart_callback_add(bt, "clicked", my_bt_5, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Buttons"); - evas_object_smart_callback_add(bt, "clicked", my_bt_6, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Toggles"); - evas_object_smart_callback_add(bt, "clicked", my_bt_7, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Table"); - evas_object_smart_callback_add(bt, "clicked", my_bt_8, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Clock"); - evas_object_smart_callback_add(bt, "clicked", my_bt_9, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Layout"); - evas_object_smart_callback_add(bt, "clicked", my_bt_10, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Hover"); - evas_object_smart_callback_add(bt, "clicked", my_bt_11, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Hover 2"); - evas_object_smart_callback_add(bt, "clicked", my_bt_12, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Entry"); - evas_object_smart_callback_add(bt, "clicked", my_bt_13, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Entry Scrolled"); - evas_object_smart_callback_add(bt, "clicked", my_bt_14, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Notepad"); - evas_object_smart_callback_add(bt, "clicked", my_bt_15, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Anchorview"); - evas_object_smart_callback_add(bt, "clicked", my_bt_16, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Anchorblock"); - evas_object_smart_callback_add(bt, "clicked", my_bt_17, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Toolbar"); - evas_object_smart_callback_add(bt, "clicked", my_bt_18, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Hoversel"); - evas_object_smart_callback_add(bt, "clicked", my_bt_19, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "List"); - evas_object_smart_callback_add(bt, "clicked", my_bt_20, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "List 2"); - evas_object_smart_callback_add(bt, "clicked", my_bt_21, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "List 3"); - evas_object_smart_callback_add(bt, "clicked", my_bt_22, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - bt = elm_button_add(win); - elm_button_label_set(bt, "Carousel"); - evas_object_smart_callback_add(bt, "clicked", my_bt_23, NULL); - evas_object_size_hint_align_set(bt, -1.0, 0.0); - elm_box_pack_end(bx, bt); - evas_object_show(bt); - - /* set an initial window size */ - evas_object_resize(win, 320, 520); - /* show the window */ - evas_object_show(win); + /* 1 create an elm window - it returns an evas object. this is a little + * special as the object lives in the canvas that is inside the window + * so what is returned is really inside the window, but as you manipulate + * the evas object returned - the window will respond. elm_win makes sure + * of that so you can blindly treat it like any other evas object + * pretty much, just as long as you know it has special significance */ + /* the first parameter is a "parent" window - eg for a dialog you want to + * have a main window it is related to, here it is NULL meaning there + * is no parent. "main" is the name of the window - used by the window + * manager for identifying the window uniquely amongst all the windows + * within this application (and all instances of the application). the + * type is a basic window (the final parameter) */ + win = elm_win_add(NULL, "main", ELM_WIN_BASIC); + /* set the title of the window - this is in the titlebar */ + elm_win_title_set(win, "Elementary Tests"); + + /* set a callback on the window when "delete-request" is emitted as + * a callback. when this happens my_win_del() is called and the + * data pointer (first param) is passed the final param here (in this + * case it is NULL). This is how you can pass specific things to a + * callback like objects or data layered on top */ + evas_object_smart_callback_add(win, "delete-request", my_win_del, NULL); + + /* add a background to our window. this just uses the standard theme set + * background. without a backgorund, you could make a window seem + * transparent with elm_win_alpha_set(win, 1); for example. if you have + * a compositor running this will make the window able to be + * semi-transparent and any space not filled by object/widget pixels will + * be transparent or translucent based on alpha. if you do not have a + * comnpositor running this should fall back to using shaped windows + * (which have a mask). both these features will be slow and rely on + * a lot more resources, so only use it if you need it. */ + bg = elm_bg_add(win); + /* set weight to 1.0 x 1.0 == expand in both x and y direction */ + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + /* tell the window that this object is to be resized along with the window. + * also as a result this object will be one of several objects that + * controls the minimum/maximum size of the window */ + elm_win_resize_object_add(win, bg); + /* and show the background */ + evas_object_show(bg); + + /* add a box layout widget to the window */ + bx0 = elm_box_add(win); + /* allow base box (bx0) to expand in x and y */ + evas_object_size_hint_weight_set(bx0, 1.0, 1.0); + /* tell the window that the box affects window size and also will be + * resized when the window is */ + elm_win_resize_object_add(win, bx0); + evas_object_show(bx0); + + fr = elm_frame_add(win); + elm_frame_label_set(fr, "Information"); + elm_box_pack_end(bx0, fr); + evas_object_show(fr); + + lb = elm_label_add(win); + elm_label_label_set(lb, + "Please slect a test from the list below
" + "by clicking the test button to show the
" + "test window."); + elm_frame_content_set(fr, lb); + evas_object_show(lb); + + li = elm_list_add(win); + evas_object_size_hint_weight_set(li, 1.0, 1.0); + evas_object_size_hint_align_set(li, -1.0, -1.0); + elm_box_pack_end(bx0, li); + evas_object_show(li); + + elm_list_item_append(li, "Bg Plain", NULL, NULL, my_bt_1, NULL); + elm_list_item_append(li, "Bg Image", NULL, NULL, my_bt_2, NULL); + elm_list_item_append(li, "Icon Transparent", NULL, NULL, my_bt_3, NULL); + elm_list_item_append(li, "Box Vert", NULL, NULL, my_bt_4, NULL); + elm_list_item_append(li, "Box Horiz", NULL, NULL, my_bt_5, NULL); + elm_list_item_append(li, "Buttons", NULL, NULL, my_bt_6, NULL); + elm_list_item_append(li, "Toggles", NULL, NULL, my_bt_7, NULL); + elm_list_item_append(li, "Table", NULL, NULL, my_bt_8, NULL); + elm_list_item_append(li, "Clock", NULL, NULL, my_bt_9, NULL); + elm_list_item_append(li, "Layout", NULL, NULL, my_bt_10, NULL); + elm_list_item_append(li, "Hover", NULL, NULL, my_bt_11, NULL); + elm_list_item_append(li, "Hover 2", NULL, NULL, my_bt_12, NULL); + elm_list_item_append(li, "Entry", NULL, NULL, my_bt_13, NULL); + elm_list_item_append(li, "Entry Scrolled", NULL, NULL, my_bt_14, NULL); + elm_list_item_append(li, "Notepad", NULL, NULL, my_bt_15, NULL); + elm_list_item_append(li, "Anchorview", NULL, NULL, my_bt_16, NULL); + elm_list_item_append(li, "Anchorblock", NULL, NULL, my_bt_17, NULL); + elm_list_item_append(li, "Toolbar", NULL, NULL, my_bt_18, NULL); + elm_list_item_append(li, "Hoversel", NULL, NULL, my_bt_19, NULL); + elm_list_item_append(li, "List", NULL, NULL, my_bt_20, NULL); + elm_list_item_append(li, "List 2", NULL, NULL, my_bt_21, NULL); + elm_list_item_append(li, "List 3", NULL, NULL, my_bt_22, NULL); + elm_list_item_append(li, "Carousel", NULL, NULL, my_bt_23, NULL); + elm_list_item_append(li, "Inwin", NULL, NULL, my_bt_24, NULL); + elm_list_item_append(li, "Inwin 2", NULL, NULL, my_bt_25, NULL); + elm_list_item_append(li, "Scaling", NULL, NULL, my_bt_26, NULL); + elm_list_item_append(li, "Scaling 2", NULL, NULL, my_bt_27, NULL); + + elm_list_go(li); + + /* set an initial window size */ + evas_object_resize(win, 320, 520); + /* show the window */ + evas_object_show(win); } /* this is your elementary main function - it MUSt be called IMMEDIATELY diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 1e68cb5448..59a483d2b0 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -140,6 +140,10 @@ extern "C" { EAPI void elm_run(void); EAPI void elm_exit(void); + EAPI void elm_object_scale_set(Evas_Object *obj, double scale); + EAPI double elm_object_scale_get(Evas_Object *obj); + EAPI void elm_object_focus(Evas_Object *obj); + EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type); EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj); EAPI void elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj); @@ -494,12 +498,16 @@ extern "C" { // * when entries are in a scroller and change size, the scroller shows scrollbars. fix. same for selecting. for 1 line entries in a scroller should only have scroll arrow indicators. // //// (more widgets/features - medium priority) +// * selective widget scaling +// * slider widget +// * +// * radio + group handling +// * checkbox (like toggle) +// * pager (for pushing/popping pages and going back and forward and flipping) +// * // * biglist widget (restricted format label + icon intended for massive lists) // * treeview widget (like biglist - but items can expand to sub-items) -// * radio widget + group handling -// * checkbox widget (like toggle) -// * page widget (for pushing/popping pages and going back and forward and flipping) -// * slider widget +// * // // * carousel selector widget // * separator widget (h/v) diff --git a/legacy/elementary/src/lib/elm_bg.c b/legacy/elementary/src/lib/elm_bg.c index 5996d34043..54e00c9b14 100644 --- a/legacy/elementary/src/lib/elm_bg.c +++ b/legacy/elementary/src/lib/elm_bg.c @@ -26,6 +26,7 @@ _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); _elm_theme_set(wd->img, "bg", "base", "default"); + _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) * _elm_config->scale); } static void diff --git a/legacy/elementary/src/lib/elm_bubble.c b/legacy/elementary/src/lib/elm_bubble.c index c186171423..c23eea40e5 100644 --- a/legacy/elementary/src/lib/elm_bubble.c +++ b/legacy/elementary/src/lib/elm_bubble.c @@ -32,6 +32,7 @@ _theme_hook(Evas_Object *obj) _elm_theme_set(wd->bbl, "bubble", "base", "default"); edje_object_part_text_set(wd->bbl, "elm.text", wd->label); edje_object_part_text_set(wd->bbl, "elm.info", wd->info); + edje_object_scale_set(wd->bbl, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } diff --git a/legacy/elementary/src/lib/elm_button.c b/legacy/elementary/src/lib/elm_button.c index c2bc1124da..a693facfd2 100644 --- a/legacy/elementary/src/lib/elm_button.c +++ b/legacy/elementary/src/lib/elm_button.c @@ -47,6 +47,7 @@ _theme_hook(Evas_Object *obj) edje_object_signal_emit(wd->btn, "elm,state,icon,hidden", "elm"); edje_object_part_text_set(wd->btn, "elm.text", wd->label); edje_object_message_signal_process(wd->btn); + edje_object_scale_set(wd->btn, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } diff --git a/legacy/elementary/src/lib/elm_carousel.c b/legacy/elementary/src/lib/elm_carousel.c index 5256fb3035..039a8417fd 100644 --- a/legacy/elementary/src/lib/elm_carousel.c +++ b/legacy/elementary/src/lib/elm_carousel.c @@ -85,6 +85,7 @@ _theme_hook(Evas_Object *obj) if (it->selected) edje_object_signal_emit(it->base, "elm,state,selected", "elm"); _elm_theme_set(it->base, "carousel", "item", "default"); + edje_object_scale_set(it->base, elm_widget_scale_get(obj) * _elm_config->scale); if (it->icon) { edje_extern_object_min_size_set(it->icon, diff --git a/legacy/elementary/src/lib/elm_clock.c b/legacy/elementary/src/lib/elm_clock.c index 44c05b505a..ea710245be 100644 --- a/legacy/elementary/src/lib/elm_clock.c +++ b/legacy/elementary/src/lib/elm_clock.c @@ -47,6 +47,7 @@ static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); + int i; wd->cur.am_pm = !wd->cur.am_pm; /* hack - force update */ _time_update(obj); } @@ -204,6 +205,7 @@ _time_update(Evas_Object *obj) _elm_theme_set(wd->clk, "clock", "base-am_pm", "default"); else _elm_theme_set(wd->clk, "clock", "base", "default"); + edje_object_scale_set(wd->clk, elm_widget_scale_get(obj) * _elm_config->scale); for (i = 0; i < 6; i++) { @@ -212,6 +214,7 @@ _time_update(Evas_Object *obj) if ((!wd->seconds) && (i >= 4)) break; wd->digit[i] = edje_object_add(evas_object_evas_get(wd->clk)); _elm_theme_set(wd->digit[i], "clock", "flipdigit", "default"); + edje_object_scale_set(wd->digit[i], elm_widget_scale_get(obj) * _elm_config->scale); if (wd->edit) edje_object_signal_emit(wd->digit[i], "elm,state,edit,on", "elm"); edje_object_signal_callback_add(wd->digit[i], "elm,action,up", "", @@ -228,6 +231,7 @@ _time_update(Evas_Object *obj) { wd->ampm = edje_object_add(evas_object_evas_get(wd->clk)); _elm_theme_set(wd->ampm, "clock", "flipampm", "default"); + edje_object_scale_set(wd->ampm, elm_widget_scale_get(obj) * _elm_config->scale); if (wd->edit) edje_object_signal_emit(wd->ampm, "elm,state,edit,on", "elm"); edje_object_signal_callback_add(wd->ampm, "elm,action,up", "", diff --git a/legacy/elementary/src/lib/elm_entry.c b/legacy/elementary/src/lib/elm_entry.c index 8b0ad16dd6..2df8818325 100644 --- a/legacy/elementary/src/lib/elm_entry.c +++ b/legacy/elementary/src/lib/elm_entry.c @@ -61,6 +61,7 @@ _theme_hook(Evas_Object *obj) _elm_theme_set(wd->ent, "entry", _getbase(obj), "default"); elm_entry_entry_set(obj, t); if (t) free(t); + edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } diff --git a/legacy/elementary/src/lib/elm_frame.c b/legacy/elementary/src/lib/elm_frame.c index 2f3e06a66a..675731af2f 100644 --- a/legacy/elementary/src/lib/elm_frame.c +++ b/legacy/elementary/src/lib/elm_frame.c @@ -32,6 +32,7 @@ _theme_hook(Evas_Object *obj) else _elm_theme_set(wd->frm, "frame", "base", "default"); if (wd->content) edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content); + edje_object_scale_set(wd->frm, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } diff --git a/legacy/elementary/src/lib/elm_hover.c b/legacy/elementary/src/lib/elm_hover.c index 0510bb860b..313bcb4232 100644 --- a/legacy/elementary/src/lib/elm_hover.c +++ b/legacy/elementary/src/lib/elm_hover.c @@ -69,6 +69,7 @@ _theme_hook(Evas_Object *obj) // FIXME: hover contents doesnt seem to propagate resizes properly if (wd->style) _elm_theme_set(wd->cov, "hover", "base", wd->style); else _elm_theme_set(wd->cov, "hover", "base", "default"); + edje_object_scale_set(wd->cov, elm_widget_scale_get(obj) * _elm_config->scale); _reval_content(obj); _sizing_eval(obj); if (evas_object_visible_get(wd->cov)) _hov_show_do(obj); @@ -99,7 +100,7 @@ _reval_content(Evas_Object *obj) for (l = wd->subs; l; l = l->next) { Subinfo *si = l->data; - edje_object_part_swallow(wd->hov, si->swallow, si->obj); + edje_object_part_swallow(wd->cov, si->swallow, si->obj); } } @@ -113,7 +114,7 @@ _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info) Subinfo *si = l->data; if (si->obj == obj) { - edje_object_part_swallow(wd->hov, si->swallow, si->obj); + edje_object_part_swallow(wd->cov, si->swallow, si->obj); break; } } diff --git a/legacy/elementary/src/lib/elm_icon.c b/legacy/elementary/src/lib/elm_icon.c index c71a135c0f..3937bf152f 100644 --- a/legacy/elementary/src/lib/elm_icon.c +++ b/legacy/elementary/src/lib/elm_icon.c @@ -54,7 +54,7 @@ _sizing_eval(Evas_Object *obj) if (wd->no_scale) _els_smart_icon_scale_set(wd->img, 1.0); else { - _els_smart_icon_scale_set(wd->img, _elm_config->scale); + _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) * _elm_config->scale); _els_smart_icon_size_get(wd->img, &w, &h); } if (!wd->scale_down) diff --git a/legacy/elementary/src/lib/elm_label.c b/legacy/elementary/src/lib/elm_label.c index 94ed5e5fad..77c3f54efa 100644 --- a/legacy/elementary/src/lib/elm_label.c +++ b/legacy/elementary/src/lib/elm_label.c @@ -27,6 +27,7 @@ _theme_hook(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); _elm_theme_set(wd->lbl, "label", "base", "default"); edje_object_part_text_set(wd->lbl, "elm.text", wd->label); + edje_object_scale_set(wd->lbl, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } diff --git a/legacy/elementary/src/lib/elm_layout.c b/legacy/elementary/src/lib/elm_layout.c index 2390859143..5987e76b8a 100644 --- a/legacy/elementary/src/lib/elm_layout.c +++ b/legacy/elementary/src/lib/elm_layout.c @@ -39,6 +39,8 @@ _del_hook(Evas_Object *obj) static void _theme_hook(Evas_Object *obj) { + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_scale_set(wd->lay, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index 3bf82a4d3d..694f472ceb 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -294,3 +294,21 @@ elm_exit(void) { ecore_main_loop_quit(); } + +EAPI void +elm_object_scale_set(Evas_Object *obj, double scale) +{ + return elm_widget_scale_set(obj, scale); +} + +EAPI double +elm_object_scale_get(Evas_Object *obj) +{ + return elm_widget_scale_get(obj); +} + +EAPI void +elm_object_focus(Evas_Object *obj) +{ + elm_widget_focus_set(obj, 1); +} diff --git a/legacy/elementary/src/lib/elm_photo.c b/legacy/elementary/src/lib/elm_photo.c index d560e5632b..b2d9f0d273 100644 --- a/legacy/elementary/src/lib/elm_photo.c +++ b/legacy/elementary/src/lib/elm_photo.c @@ -25,6 +25,8 @@ _del_hook(Evas_Object *obj) static void _theme_hook(Evas_Object *obj) { + Widget_Data *wd = elm_widget_data_get(obj); + edje_object_scale_set(wd->frm, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } @@ -35,8 +37,8 @@ _sizing_eval(Evas_Object *obj) Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; evas_object_size_hint_min_set(wd->img, - wd->size * _elm_config->scale, - wd->size * _elm_config->scale); + wd->size * elm_widget_scale_get(obj) * _elm_config->scale, + wd->size * elm_widget_scale_get(obj) * _elm_config->scale); edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->img); edje_object_size_min_calc(wd->frm, &minw, &minh); maxw = minw; @@ -75,7 +77,7 @@ elm_photo_add(Evas_Object *parent) _els_smart_icon_scale_down_set(wd->img, 1); _els_smart_icon_smooth_scale_set(wd->img, 1); _els_smart_icon_fill_inside_set(wd->img, 0); - _els_smart_icon_scale_set(wd->img, _elm_config->scale); + _els_smart_icon_scale_set(wd->img, elm_widget_scale_get(obj) * _elm_config->scale); evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP, _mouse_up, obj); evas_object_repeat_events_set(wd->img, 1); diff --git a/legacy/elementary/src/lib/elm_priv.h b/legacy/elementary/src/lib/elm_priv.h index 087fe8092e..268733f239 100644 --- a/legacy/elementary/src/lib/elm_priv.h +++ b/legacy/elementary/src/lib/elm_priv.h @@ -92,7 +92,9 @@ EAPI void elm_widget_show_region_get(Evas_Object *obj, Evas_Coord *x, Ev EAPI void elm_widget_scroll_hold_push(Evas_Object *obj); EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj); EAPI int elm_widget_scroll_hold_get(Evas_Object *obj); - +EAPI void elm_widget_scale_set(Evas_Object *obj, double scale); +EAPI double elm_widget_scale_get(Evas_Object *obj); + extern char *_elm_appname; extern Elm_Config *_elm_config; extern const char *_elm_data_dir; diff --git a/legacy/elementary/src/lib/elm_scroller.c b/legacy/elementary/src/lib/elm_scroller.c index 30a28be9f5..e4676336e3 100644 --- a/legacy/elementary/src/lib/elm_scroller.c +++ b/legacy/elementary/src/lib/elm_scroller.c @@ -29,6 +29,7 @@ _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); elm_smart_scroller_theme_set(wd->scr, "scroller", "base", "default"); + edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } diff --git a/legacy/elementary/src/lib/elm_toggle.c b/legacy/elementary/src/lib/elm_toggle.c index 4675357166..e3ccfc3bcf 100644 --- a/legacy/elementary/src/lib/elm_toggle.c +++ b/legacy/elementary/src/lib/elm_toggle.c @@ -52,6 +52,7 @@ _theme_hook(Evas_Object *obj) edje_object_part_text_set(wd->tgl, "elm.ontext", wd->ontext); edje_object_part_text_set(wd->tgl, "elm.offtext", wd->offtext); edje_object_message_signal_process(wd->tgl); + edje_object_scale_set(wd->tgl, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); } diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 1b186138a4..8a0a0c318f 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -2,8 +2,15 @@ #include "elm_priv.h" #define SMART_NAME "e_widget" -#define API_ENTRY Smart_Data *sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME))) -#define INTERNAL_ENTRY Smart_Data *sd = evas_object_smart_data_get(obj); if (!sd) return; +#define API_ENTRY \ + Smart_Data *sd = evas_object_smart_data_get(obj); \ + if ((!obj) || (!sd) || \ + (evas_object_type_get(obj) && \ + strcmp(evas_object_type_get(obj), SMART_NAME))) +#define INTERNAL_ENTRY \ + Smart_Data *sd = evas_object_smart_data_get(obj); \ + if (!sd) return; + typedef struct _Smart_Data Smart_Data; struct _Smart_Data @@ -29,6 +36,7 @@ struct _Smart_Data void *data; Evas_Coord rx, ry, rw, rh; int scroll_hold; + double scale; unsigned char can_focus : 1; unsigned char child_can_focus : 1; unsigned char focused : 1; @@ -180,6 +188,7 @@ EAPI void elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj) { API_ENTRY return; + double scale, pscale = elm_widget_scale_get(sobj); sd->subobjs = eina_list_append(sd->subobjs, sobj); if (!sd->child_can_focus) { @@ -196,6 +205,8 @@ elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj) } evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd); evas_object_smart_callback_call(obj, "sub-object-add", sobj); + scale = elm_widget_scale_get(sobj); + if (scale != pscale) elm_widget_theme(sobj); } EAPI void @@ -694,6 +705,26 @@ elm_widget_scroll_hold_get(Evas_Object *obj) return sd->scroll_hold; } +EAPI void +elm_widget_scale_set(Evas_Object *obj, double scale) +{ + API_ENTRY return; + if (scale <= 0.0) scale = 0.0; + if (sd->scale != scale) + { + sd->scale = scale; + elm_widget_theme(obj); + } +} + +EAPI double +elm_widget_scale_get(Evas_Object *obj) +{ + API_ENTRY return 1.0; + if (sd->scale == 0.0) return elm_widget_scale_get(sd->parent_obj); + return sd->scale; +} + /* local subsystem functions */ static void _smart_reconfigure(Smart_Data *sd)