forked from enlightenment/efl
allow for all widgets.objects to have different scaling factors.
add tests for these add tests for inheriting scaling factor from parent fix test app to use list now instead of box+buttons (cleaner) SVN revision: 38909
This commit is contained in:
parent
680daaa606
commit
986fcca059
|
@ -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<br>"
|
||||
"window. This is handy for quick popups<br>"
|
||||
"you want centered, taking over the window<br>"
|
||||
"until dismissed somehow. Unlike hovers they<br>"
|
||||
"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<br>"
|
||||
"window. This is handy for quick popups<br>"
|
||||
"you want centered, taking over the window<br>"
|
||||
"until dismissed somehow. Unlike hovers they<br>"
|
||||
"don't hover over their target.<br>"
|
||||
"<br>"
|
||||
"This inwin style compacts itself vertically<br>"
|
||||
"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<br>"
|
||||
"is 0.5. Child should<br>"
|
||||
"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<br>"
|
||||
"is 1.0. Child should<br>"
|
||||
"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<br>"
|
||||
"is 2.0. Child should<br>"
|
||||
"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");
|
||||
/* 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);
|
||||
/* 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 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);
|
||||
/* 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);
|
||||
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<br>"
|
||||
"by clicking the test button to show the<br>"
|
||||
"test window.");
|
||||
elm_frame_content_set(fr, lb);
|
||||
evas_object_show(lb);
|
||||
lb = elm_label_add(win);
|
||||
elm_label_label_set(lb,
|
||||
"Please slect a test from the list below<br>"
|
||||
"by clicking the test button to show the<br>"
|
||||
"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);
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
elm_list_go(li);
|
||||
|
||||
/* 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);
|
||||
/* 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
|
||||
|
|
|
@ -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
|
||||
// * <evas scale cache>
|
||||
// * radio + group handling
|
||||
// * checkbox (like toggle)
|
||||
// * pager (for pushing/popping pages and going back and forward and flipping)
|
||||
// * <edje copy & paste fixed>
|
||||
// * 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
|
||||
// * <evas shared cache>
|
||||
//
|
||||
// * carousel selector widget
|
||||
// * separator widget (h/v)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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", "",
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -92,6 +92,8 @@ 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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue