CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(ui-viewmgr)
+PROJECT(org.tizen.ui-viewmgr)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_DIR ${PREFIX})
-SET(BINDIR ${PREFIX}/bin)
+SET(VERSION 0.1.0)
+SET(VENDOR "samsung")
+
+SET(LIBNAME ui-viewmgr)
SET(LIBDIR ${PREFIX}/lib)
SET(INCDIR ${PREFIX}/include)
-SET(IMGDIR ${PREFIX}/share/${PROJECT_NAME}/images)
-SET(VERSION_MAJOR 0)
-SET(VERSION ${VERSION_MAJOR}.1.0)
-SET(VENDOR "samsung")
-SET(PACKAGE ${PROJECT_NAME})
+SET(EDJDIR "/usr/share/edje/${LIBNAME}")
+
+SET(BINNAME ui.viewmgr.demo)
+SET(BINDIR /opt/usr/apps/${BINNAME})
+SET(IMGDIR ${BINDIR}/data/images)
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
-IF(NOT DBDIR)
- SET(DBDIR "$ENV{HOME}")
-ENDIF(NOT DBDIR)
-ADD_DEFINITIONS("-DDBDIR=\"${DBDIR}\"")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DVERSION=\"${VERSION}\"")
-ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
-ADD_DEFINITIONS("-DPLUGINDIR=\"${PLUGINDIR}\"")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wall")
-
-SET(EDJ_PATH "${RESDIR}/edje")
+ADD_DEFINITIONS("-DBINNAME=\"${BINNAME}\"")
+ADD_DEFINITIONS("-DLOCALE_DIR=\"${LOCALEDIR}\"")
INCLUDE(FindPkgConfig)
-ADD_SUBDIRECTORY(src)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -O2 -Wall -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -Wall -fPIE -std=c++0x")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+ADD_SUBDIRECTORY(src)
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
+#pc file
+CONFIGURE_FILE(pc/${LIBNAME}.pc.in pc/${LIBNAME}.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pc/${LIBNAME}.pc DESTINATION lib/pkgconfig)
-ADD_CUSTOM_TARGET(${PROJECT_NAME}.edj
+#edj file
+ADD_CUSTOM_TARGET(${LIBNAME}.edj
COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/data/edc
- ${CMAKE_SOURCE_DIR}/data/edc/${PROJECT_NAME}.edc ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj
- DEPENDS ${CMAKE_SOURCE_DIR}/data/edc/${PROJECT_NAME}.edc
+ ${CMAKE_SOURCE_DIR}/data/edc/${LIBNAME}.edc ${CMAKE_BINARY_DIR}/data/edc/${LIBNAME}.edj
+ DEPENDS ${CMAKE_SOURCE_DIR}/data/edc/${LIBNAME}.edc
)
-ADD_DEPENDENCIES(${PROJECT_NAME} ${PROJECT_NAME}.edj)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj DESTINATION /usr/share/edje/${PROJECT_NAME})
+ADD_DEPENDENCIES(${LIBNAME} ${LIBNAME}.edj)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/data/edc/${LIBNAME}.edj DESTINATION ${EDJDIR})
+
+#xml file
+CONFIGURE_FILE(${BINNAME}.xml.in ${BINNAME}.xml @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${BINNAME}.xml DESTINATION /usr/share/packages/)
+
+#image file
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION ${IMGDIR} FILES_MATCHING PATTERN "*.png")
Name: ui-viewmgr
Summary: UI VIEW MANAGER library
-Version: 0.1.1
+Version: 0.1.0
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0
BuildRequires: cmake
BuildRequires: edje-bin
BuildRequires: gettext-tools
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
%description
UI VIEW MANAGER library
-%package example
-Summary: UI VIEW MANAGER Example Application
+%package ui.viewmgr.demo
+Summary: UI VIEW MANAGER Demo Application
Group: Development/Applications
-%description example
-UI VIEW MANAGER Example Application
+%description ui.viewmgr.demo
+UI VIEW MANAGER Demo Application
%package devel
Summary: UI VIEW MANAGER library (devel)
mkdir -p %{buildroot}/usr/share/license
cp %{_builddir}/%{buildsubdir}/LICENSE %{buildroot}/usr/share/license/%{name}
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
%files
%defattr(-,root,root,-)
%{_libdir}/libui-viewmgr.so.*
-%manifest %{name}.manifest
-%{_datadir}/ui-viewmgr/images/*
+%manifest ui-viewmgr.manifest
/usr/share/license/%{name}
/usr/share/edje/ui-viewmgr/ui-viewmgr.edj
-%files example
+%files ui.viewmgr.demo
%defattr(-,root,root,-)
-/opt/usr/apps/ui-viewmgr/bin/*
+%{_datadir}/packages/ui.viewmgr.demo.xml
+%manifest ui.viewmgr.demo.manifest
+/opt/usr/apps/ui.viewmgr.demo/bin/*
+/opt/usr/apps/ui.viewmgr.demo/data/images/*
%files devel
%defattr(-,root,root,-)
prefix=@PREFIX@
-exec_prefix=@EXEC_DIR@
libdir=@LIBDIR@
includedir=@INCDIR@
-Name: UI VIEW MANAGER
-Description: An UI VIEW MANAGER library
+Name: UI View Manager
+Description: Tizen UI View Manager library
Version: @VERSION@
Requires:
Libs: -L${libdir} -lui-viewmgr
-SET(LIB_NAME ${PROJECT_NAME})
-
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/lib)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(examples/efl)
-
-SET(EXAM_NAME viewmgr_demo)
-SET(EXAM_SRCS
- ../../lib/efl/ui_base_view.cpp
- ../../lib/efl/ui_base_viewmgr.cpp
- ../../lib/efl/ui_base_key_listener.cpp
- ../../lib/efl/mobile/ui_menu.cpp
- ../../lib/efl/mobile/ui_popup.cpp
- ../../lib/efl/mobile/ui_view.cpp
- ../../lib/efl/mobile/ui_key_listener.cpp
- ../../lib/efl/mobile/ui_viewmgr.cpp
- main.cpp
+SET(SRCS
+ main.cpp
)
-ADD_EXECUTABLE(${EXAM_NAME} ${EXAM_SRCS})
+ADD_EXECUTABLE(${BINNAME} ${SRCS})
-PKG_CHECK_MODULES(EXAM_PKGS REQUIRED elementary efl-extension dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager)
+ADD_DEFINITIONS("-DBINDIR=\"${BINDIR}\"")
-PKG_CHECK_MODULES(EXAM_PKGS REQUIRED elementary dlog efl-extension)
+PKG_CHECK_MODULES(BIN_PKGS REQUIRED elementary dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager)
-FOREACH(flag ${EXAM_PKGS_CFLAGS})
- SET(EXAM_CFLAGS "${EXAM_CFLAGS} ${flag}")
+FOREACH(flag ${BIN_PKGS_CFLAGS})
+ SET(PKG_CFLAGS "${PKG_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET_TARGET_PROPERTIES(${EXAM_NAME} PROPERTIES COMPILE_FLAGS "${EXAM_CFLAGS}")
-TARGET_LINK_LIBRARIES(${EXAM_NAME} ${EXAM_PKGS_LDFLAGS} ${EXAM_TARGET_PKGS_LDFLAGS})
-TARGET_LINK_LIBRARIES(${EXAM_NAME} ${EXAM_PKGS_LDFLAGS} ${LIB_NAME})
+SET_TARGET_PROPERTIES(${BINNAME} PROPERTIES COMPILE_FLAGS "${PKG_CFLAGS}" LINK_FLAGS -pie)
+TARGET_LINK_LIBRARIES(${BINNAME} ${BIN_PKGS_LDFLAGS} ${LIBNAME})
-SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS} -Wall -Werror -Wno-unused -Wno-format-extra-args -Wl,--no-undefined -fvisibility=hidden -fPIC -std=c++0x ${GC_SECTIONS_FLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS}")
-INSTALL(TARGETS ${EXAM_NAME} DESTINATION /opt/usr/apps/ui-viewmgr/bin)
+INSTALL(TARGETS ${BINNAME} DESTINATION ${BINDIR}/bin)
Evas_Object*
create_landscape_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb)
{
- char buf[128];
+ char buf[PATH_MAX];
Elm_Grid *grid;
Elm_Box *box;
Elm_Layout *layout;
/* Image */
image = elm_image_add(grid);
- snprintf(buf, sizeof(buf), "/usr/share/ui-viewmgr/images/tizen.png");
+ snprintf(buf, sizeof(buf), "%s/data/images/tizen.png", BINDIR);
elm_image_file_set(image, buf, NULL);
evas_object_show(image);
elm_grid_pack(grid, image, 50, 0, 50, 85);
return scroller;
}
-static void create_base_gui(appdata_s *ad)
+static void create_base_gui(void)
{
create_page1();
UI_VIEWMGR->activate();
}
-int
-elm_main(int argc, char **argv)
+static bool app_create(void *data)
{
- appdata_s *ad = {0,};
+ /* Hook to take necessary actions before main event loop starts
+ Initialize UI resources and application's data
+ If this function returns true, the main loop of application starts
+ If this function returns false, the application is terminated */
- ad = static_cast<appdata_s *>(calloc(1, sizeof(appdata_s)));
+ elm_app_base_scale_set(2.6);
+
+ /* Bind package locale file */
+ bindtextdomain(PACKAGE, LOCALE_DIR);
+ textdomain(PACKAGE);
//FIXME: Hide this creation.
ui_viewmgr *viewmgr = new ui_viewmgr(PACKAGE);
- create_base_gui(ad);
+ create_base_gui();
+
+ return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+ /* Handle the launch request. */
+}
+
+static void app_pause(void *data)
+{
+}
+
+static void app_resume(void *data)
+{
+}
+
+static void app_terminate(void *data)
+{
+}
+
+static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LANGUAGE_CHANGED*/
+ char *locale = NULL;
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+ elm_language_set(locale);
+ free(locale);
+ return;
+}
+
+static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+ return;
+}
- elm_run();
- elm_shutdown();
- return 0;
+static void ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_REGION_FORMAT_CHANGED*/
}
-ELM_MAIN()
+static void ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_MEMORY*/
+}
+
+int main(int argc, char *argv[])
+{
+ appdata_s ad;
+ int ret = 0;
+
+ ui_app_lifecycle_callback_s event_callback = { 0, };
+ app_event_handler_h handlers[5] = { NULL, };
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.pause = app_pause;
+ event_callback.resume = app_resume;
+ event_callback.app_control = app_control;
+
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED,
+ ui_app_orient_changed, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed,
+ &ad);
+ ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
+ }
+
+ return ret;
+}
* limitations under the License.
*
*/
-#include <Elementary.h>
-//#include <system_settings.h>
+#include <app.h>
+#include <system_settings.h>
#include <dlog.h>
#include "ui_viewmanager.h"
using namespace efl_viewmgr;
typedef struct appdata {
- ui_viewmgr *viewmgr;
} appdata_s;
Evas_Object *create_landscape_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb);
*/
static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info)
{
- ui_view *view = static_cast<ui_view *>(data);
Elm_Object_Item *it = static_cast<Elm_Object_Item *>(event_info);
elm_ctxpopup_dismiss(obj);
LOGE("Item (%s) is selected", elm_object_item_text_get(it));
INSTALL(
- DIRECTORY ./ DESTINATION include/${LIB_NAME}
+ DIRECTORY ./ DESTINATION include/${LIBNAME}
FILES_MATCHING
PATTERN "interface/*.h"
PATTERN "efl/*.h"
template<typename T>
bool ui_iface_overlay<T>::set_content(T content)
{
- T prev = this->content;
this->content = content;
return true;
}
template<typename T>
bool ui_iface_view<T>::set_content(T content)
{
- T prev = this->content;
this->content = content;
return true;
}
return false;
}
- ui_iface_view<T> *bview;
-
if (this->view_list.size() > 0)
{
for (it = this->view_list.begin(); it != this->view_list.end(); it++)
-SET(LIB_SRCS
+SET(SRCS
efl/ui_base_view.cpp
efl/ui_base_viewmgr.cpp
efl/ui_base_key_listener.cpp
efl/mobile/ui_viewmgr.cpp
)
-ADD_LIBRARY(${LIB_NAME} SHARED ${LIB_SRCS})
-
+ADD_LIBRARY(${LIBNAME} SHARED ${SRCS})
ADD_DEFINITIONS("-DEXPORT_API=__attribute__((visibility(\"default\")))")
-PKG_CHECK_MODULES(LIB_PKGS REQUIRED elementary efl-extension dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager)
+ADD_DEFINITIONS("-DEDJ_PATH=\"${EDJDIR}\"")
+
+PKG_CHECK_MODULES(LIB_PKGS REQUIRED elementary dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager)
FOREACH(flag ${LIB_PKGS_CFLAGS})
SET(LIB_CFLAGS "${LIB_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES COMPILE_FLAGS "${LIB_CFLAGS}")
-SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${VERSION})
-SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
-TARGET_LINK_LIBRARIES(${LIB_NAME} ${LIB_PKGS_LDFLAGS} ${LIB_TARGET_PKGS_LDFLAGS})
+SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_FLAGS "${LIB_CFLAGS}" VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(${LIBNAME} ${LIB_PKGS_LDFLAGS})
-SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS} -Wall -Werror -Wno-unused -Wno-format-extra-args -Wl,--no-undefined -fvisibility=hidden -fPIC -std=c++0x ${GC_SECTIONS_FLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS}")
-INSTALL(TARGETS ${LIB_NAME} DESTINATION lib)
+INSTALL(TARGETS ${LIBNAME} DESTINATION lib)
*/
#include "../../../include/efl/mobile/ui_viewmanager.h"
-//FIXME: is it correct to define here?
-#define EDJ_PATH "/usr/share/edje/ui-viewmgr/ui-viewmgr.edj"
-#define GROUP "tizen_view/default"
+#define DEFAULT_GROUP "tizen_view/default"
using namespace efl_viewmgr;
using namespace viewmgr;
Elm_Layout *layout = elm_layout_add(this->get_parent());
LAYOUT_VALIDATE();
- if (!elm_layout_file_set(layout, EDJ_PATH, GROUP))
+ char buf[PATH_MAX];
+ snprintf(buf, sizeof(buf), "%s/ui-viewmgr.edj", EDJ_PATH);
+
+ if (!elm_layout_file_set(layout, buf, DEFAULT_GROUP))
{
- LOGE("Failed to set file = ui_view(%p), path(%s), group(%s)", this, EDJ_PATH, GROUP);
+ LOGE("Failed to set file = ui_view(%p), path(%s), group(%s)", this, buf, DEFAULT_GROUP);
evas_object_del(layout);
return false;
}
using namespace efl_viewmgr;
using namespace viewmgr;
-//FIXME: is it correct to define here?
-#define EDJ_PATH "/usr/share/edje/ui-viewmgr/ui-viewmgr.edj"
-
bool ui_base_viewmgr::create_base_layout(Elm_Conformant *conform, const char *style)
{
- char buf[128];
+ char edj_path[PATH_MAX];
+ char group_name[128];
+
Elm_Layout *layout = elm_layout_add(conform);
if (!layout) return false;
- //FIXME: Is it C programming style? need to change?
- snprintf(buf, sizeof(buf), "transition/%s", style);
- //default transition layout
- elm_layout_file_set(layout, EDJ_PATH, buf);
+ snprintf(group_name, sizeof(group_name), "transition/%s", style);
+ snprintf(edj_path, sizeof(edj_path), "%s/ui-viewmgr.edj", EDJ_PATH);
+ elm_layout_file_set(layout, edj_path, group_name);
elm_object_content_set(conform, layout);
//Push Finished Event
<manifest>
- <define>
- <domain name="ui-viewmgr"/>
- <request>
- <smack request="xorg" type="wx"/>
- <smack request="system::homedir" type="rwx"/>
- <smack request="isf" type="rx"/>
- <smack request="tizen::vconf::public::r::platform::rw" type="rl"/>
- <smack request="tizen::vconf::setting" type="rl"/>
- <smack request="device::sys_logging" type="rw"/>
- <smack request="tizen::vconf::camcorder" type="rl"/>
- <smack request="tizen::vconf::setting::admin" type="rl"/>
- <smack request="device::app_logging" type="rwx"/>
- <smack request="pulseaudio" type="w"/>
- <smack request="sdbd" type="rw"/>
- <smack request="dbus" type="w"/>
- <smack request="pkgmgr::db" type="rwl"/>
- </request>
- <permit>
- <smack permit="xorg" type="rwx"/>
- <smack permit="_" type="rw"/>
- </permit>
- </define>
+ <request>
+ <domain name="_"/>
+ </request>
</manifest>
--- /dev/null
+<manifest>
+ <define>
+ <domain name="ui.viewmgr.demo"/>
+ <request>
+ <smack request="ui-viewmgr" type="rx"/>
+ <smack request="org.tizen.indicator" type="rwx"/>
+ <smack request="system::homedir" type="rwx"/>
+ <smack request="pulseaudio" type="rwx"/>
+ <smack request="pkgmgr::db" type="rw"/>
+ <smack request="xorg" type="w"/>
+ </request>
+ </define>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="@BINNAME@" version="0.1.0" install-location="internal-only">
+ <ui-application appid="@BINNAME@" exec="@BINDIR@/bin/@BINNAME@" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <label>ui.viewmgr.demo</label>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/appmanager.kill.bgapp</privilege>
+ </privileges>
+</manifest>