naviframe_example.c: added very simple naviframe example.

This commit is contained in:
Daniel Juyung Seo 2013-06-19 01:55:46 +09:00
parent 6ae4796cd1
commit a7082cfb73
4 changed files with 54 additions and 0 deletions

View File

@ -60,6 +60,7 @@
/map_example_03
/mapbuf_example
/menu_example_01
/naviframe_example
/notify_example_01
/panel_example_01
/panes_example

View File

@ -114,6 +114,7 @@ map_example_02.c \
map_example_03.c \
mapbuf_example.c \
menu_example_01.c \
naviframe_example.c \
notify_example_01.c \
panes_example.c \
panel_example_01.c \
@ -252,6 +253,7 @@ map_example_02 \
map_example_03 \
mapbuf_example \
menu_example_01 \
naviframe_example \
notify_example_01 \
panes_example \
panel_example_01 \

View File

@ -0,0 +1,48 @@
//Compile with:
//gcc -g naviframe_example.c -o naviframe_example `pkg-config --cflags --libs elementary`
#include <Elementary.h>
void
_btn_cb(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *nf = data, *btn;
if (!nf) return;
btn = elm_button_add(nf);
elm_object_text_set(btn, "Go to Second Page.");
evas_object_smart_callback_add(btn, "clicked", _btn_cb, nf);
elm_naviframe_item_push(nf, "Next Page", NULL, NULL, btn, NULL);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *nf, *btn;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("naviframe", "Naviframe");
elm_win_autodel_set(win, EINA_TRUE);
evas_object_resize(win, 400, 400);
evas_object_show(win);
nf = elm_naviframe_add(win);
evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, nf);
evas_object_show(nf);
btn = elm_button_add(nf);
elm_object_text_set(btn, "Go to Second Page.");
evas_object_smart_callback_add(btn, "clicked", _btn_cb, nf);
elm_naviframe_item_push(nf, "First Page", NULL, NULL, btn, NULL);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()

View File

@ -73,6 +73,9 @@
* What happens is that the topmost item of a naviframe will be the
* widget's target layout, when accessed directly. Items lying below
* the top one can be interacted with this way.
*
* Here is an example on its usage:
* @li @ref naviframe_example
*/
/**