basic ui application - tizen wiki · basic ui application (tizen ver 2.3) ... function which...
TRANSCRIPT
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
Basic UI ApplicationTizen Ver 2.3. Native Application Development
2015.05.16
Ajou University
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
Basic UI Applicationorganization and executing process
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
Start Native Development
APIs which we can use for developing Tizen Native Applications
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
Start Native UI Application
New > Tizen Native
Project > UI Application >
Basic UI Application
Write project name and
Click finish button.
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/inc/(project name).h
• <app.h> : library for using Application API
– Application API: provides functions to manage
the main event loop, the application’s state
change events, basic system events, and get
information about the application
• <Elementary.h>: library for using EFL’s
elementaries including important libraries
such as Eina.h, Eet.h, Evas.h, Ecore.h, and
Edje.h
• <efl_extension.h>: Menu and Back key
events for the naviframe
• <dlog.h>: send log output
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/main function
appdata_s structure contains evas objects and is used in a parameter of ui_app_main()function.
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/main function
ui_app_lifecycle_callback_s structure contains the set of callback functions for handling application life cycle events.It is one of the input parameters of the ui_app_main() function.
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/main function
ui_app_lifecycle_callback_sStructure
stores lifecycle callback functions
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/main function
each function user defined for each lifecycle event is stored
int ui_app_add_event_handler (app_event_handler_h *event_handler, app_event_type_e event_type,app_event_cb callback, void *user_data)
adds the system event handler
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/main function
int ui_app_main (int argc,char ** argv,ui_app_lifecycle_callback_s * callback,void * user_data)
Runs the application’s main loop until ui_app_exit() is calledapp_create_cb() callback function is called to initialize the application before the main loop of application starts up0 on success, otherwise a negative error value
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/app_create_cb()
• In basic UI application, app_create_cb() callback function is coded by app_create() function.
• When app_create() function is called, it calls create_base_gui() function which generates a screen of this native UI application.
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
create_base_gui() generates elements composing the screen of application using evas objects
window
conformant
base layout
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()window
conformant
base layout
Evas_Object* elm_win_util_standard_add(
const char * name,const char * title)
adds a window object with standard setup.name: the name of the windowtitle: the title of the window
void elm_win_autodel_set(
Evas_Object * obj,Eina_Bool autodel)
set the window’s autodel state.obj: window objectautodel: if true, the window well automatically delete itself when closed
void elm_win_conformant_set(Evas_Object * obj,Eina_Bool conformant)
set if this window is an illume conformant windowobj: window objectconformant: conformant flag (1 = conformant, 0= non-conformant)
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
Eina_Boolelm_win_wm_rotation_supported_get(
const Evas_Object * obj)
query whether window manager supports window rotation or notreturn value: EINA_TRUE or EINA_FALSE
void elm_win_wm_rotation_available_rotations_set( Evas_Object *obj,
const int *rotations, unsigned int count)
set the array of available window rotationsWM sets the orientation of the window properlyrotations: the array of rotation valuescount: the number of arrays of rotations
void evas_object_event_callback_add(
Evas_Object * obj,Evas_Callback_Type type,Evas_Object_Event_Cb func,const void * data)
adds or registers a callback function to a givenEvas object eventobj: the object to attach a callback totype: the type of event that triggers the callback/data: data pointer to be passed to func
window
conformant
base layout
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
registering callback method event to call ui_app_exit() when object is deleted
mouse in/out, mouse button down/up, mouse move/wheel, multi-touch down/up/move, object being freed, key release, focus in/out, show, hide, move, resize, restack, object being deleted, hold, size hints changed, canvas got/lost
focus as a whole, …
available types to be set for Evas canvases or Evasobjects
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
mouse in/out, mouse button down/up, mouse move/wheel, multi-touch down/up/move, object being freed, key release, focus in/out, show, hide, move, resize, restack, object being deleted, hold, size hints changed, canvas got/lost
focus as a whole, …
some Evas callbacks’ illustration
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()window
conformant
base layout
Evas_Object* elm_conformant_add(Evas_Object * parent)
adds a new conformant widget to the given parent Elementary (container) object
void elm_win_indicator_mode_set(Evas_Object * obj,
Elm_Win_Indicator_Mode mode)
sets the indicator mode of the windowmode: different indicator states (unknown/ hide/show)
void elm_win_indicator_opacity_set(Evas_Object * obj,
Elm_Win_Indicator_Opacity_Mode mode)
sets the indicator opacity mode of the windowmode: (opacity unknown/opaque/ translucent/transparent/background transparent)
void elm_win_resize_object_add(Evas_Object * obj,
Evas_Object * subobj)
adds subobj as a resize object of the window objobj: window objectsubobj: resize object to add
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
window
conformant
base layout
void evas_object_show(Evas_Object * obj)
makes the given Evas object visible
void evas_object_size_hint_weight_set (
Evas_Object * obj,double x,double y)
sets the hints for an object’s weightobj: the given Evas object to query hints fromx: the non-negative double value to use as horizontal weight hinty: the non-negative double value to use as vertical weight hint
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
window
conformant
base layout
char* app_get_resource(const char *resource, char *buffer, int size);
gets the absolute path to the resource included in application packageresource: resource’s path relative to the resource directory of the application packagebuffer: the pre-allocated buffer where the absolute path to the resource is storedsize: the size of buffer in bytes
Evas_Object* elm_layout_add (Evas_Object * parent )
adds a new layout to the parent
in header file
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
window
conformant
base layout
Eina_Bool elm_layout_file_set(Evas_Object * obj,
const char * file,const char * group )
sets the file that is used as a layoutobj: the layout objectfile: the path to the file (edj) that is used as a layoutgroup: the group that the layout belongs to in the edje file
void elm_object_part_text_set(Evas_Object * obj,
const char * part,const char * text )
sets the text of an objectobj: the elementary objectpart: the text part name to set (NULL to be default part)text: the new text of the part
in header file
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
window
conformant
base layout
header file
.edc file
writing a text “Hello EFL” to a part having name “txt_title”
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
/src/create_base_gui()
window
conformant
base layout
void eext_object_event_callback_add
( Evas_Object * obj,
Eext_Callback_Type type,Eext_Event_Cb func,void * data )
add a callback function to a given evas object
void elm_object_part_text_set(Evas_Object * obj,
const char * part,const char * text )
sets the text of an objectobj: the elementary objectpart: the text part name to set (NULL to be default part)text: the new text of the part
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
Execution Result
<Basic UI application initial screen>
base layout
“txt_title”
Ajou Univrsity
Basic UI Application (Tizen Ver 2.3)
Summary
• Run application,
register lifecycle callback method
ui_app_main()add the system event handler
app_created_cb()
Runs the application’s main loop
create_base_gui()
call
window
conformant
base layout
generate gui
evas_object_show()
application is executed