From: Paul Wisbey Date: Wed, 25 Mar 2015 14:05:01 +0000 (+0000) Subject: Added Demo specific stylesheets X-Git-Tag: dali_1.0.38~7^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9166cf20c6ff83679746357f8956874ae1568ff8;p=platform%2Fcore%2Fuifw%2Fdali-demo.git Added Demo specific stylesheets Change-Id: I05a17ea530a14e94040f24db332178335ce3ce52 --- diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 5550f8e..2f68697 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -20,10 +20,14 @@ SET(RESOURCE_DIR ${ROOT_SRC_DIR}/resources) SET(LOCAL_IMAGES_DIR ${RESOURCE_DIR}/images) SET(LOCAL_MODELS_DIR ${RESOURCE_DIR}/models) SET(LOCAL_SCRIPTS_DIR ${RESOURCE_DIR}/scripts) +IF(NOT DEFINED LOCAL_STYLE_DIR) + SET(LOCAL_STYLE_DIR ${RESOURCE_DIR}/style) +ENDIF() SET(IMAGES_DIR ${APP_DATA_DIR}/images/) SET(MODELS_DIR ${APP_DATA_DIR}/models/) SET(SCRIPTS_DIR ${APP_DATA_DIR}/scripts/) +SET(STYLE_DIR ${APP_DATA_DIR}/style/) IF(NOT DEFINED LOCALE_DIR) SET(LOCALE_DIR ${PREFIX}/share/locale) @@ -32,6 +36,8 @@ ENDIF() SET(DALI_IMAGE_DIR \\"${IMAGES_DIR}\\") SET(DALI_MODEL_DIR \\"${MODELS_DIR}\\") SET(DALI_SCRIPT_DIR \\"${SCRIPTS_DIR}\\") +SET(DALI_STYLE_DIR \\"${STYLE_DIR}\\") +SET(DALI_DEMO_THEME_PATH \\"${STYLE_DIR}/demo-theme.json\\") SET(DALI_EXAMPLE_BIN \\"${BINDIR}/\\") SET(DALI_LOCALE_DIR \\"${LOCALE_DIR}\\") SET(DALI_LANG \\"${LANG}\\") @@ -58,6 +64,8 @@ FOREACH(flag ${LOCAL_SCRIPTS_LIST}) INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/${flag} DESTINATION ${SCRIPTS_DIR}) ENDFOREACH(flag) +INSTALL(FILES ${LOCAL_STYLE_DIR}/demo-theme.json DESTINATION ${STYLE_DIR}) + SET(PKG_LIST dali dali-toolkit) @@ -68,7 +76,7 @@ FOREACH(flag ${REQUIRED_PKGS_CFLAGS}) SET(REQUIRED_CFLAGS "${REQUIRED_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(DALI_DEMO_CFLAGS "-DDALI_IMAGE_DIR=${DALI_IMAGE_DIR} -DDALI_MODEL_DIR=${DALI_MODEL_DIR} -DDALI_SCRIPT_DIR=${DALI_SCRIPT_DIR} -DDALI_EXAMPLE_BIN=${DALI_EXAMPLE_BIN} -DDALI_LOCALE_DIR=${DALI_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDALI_LANG=${DALI_LANG}") +SET(DALI_DEMO_CFLAGS "-DDALI_IMAGE_DIR=${DALI_IMAGE_DIR} -DDALI_MODEL_DIR=${DALI_MODEL_DIR} -DDALI_SCRIPT_DIR=${DALI_SCRIPT_DIR} -DDALI_DEMO_THEME_PATH=${DALI_DEMO_THEME_PATH} -DDALI_EXAMPLE_BIN=${DALI_EXAMPLE_BIN} -DDALI_LOCALE_DIR=${DALI_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDALI_LANG=${DALI_LANG}") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall") SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index a0ae7d1..b258581 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -15,6 +15,10 @@ * */ +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES #include "dali-table-view.h" #include "shared/dali-demo-strings.h" @@ -29,6 +33,7 @@ int main(int argc, char **argv) Application app = Application::New(&argc, &argv); + // Create the demo launcher DaliTableView demo(app); demo.AddExample(Example("bubble-effect.example", DALI_DEMO_STR_TITLE_BUBBLES)); @@ -52,6 +57,8 @@ int main(int argc, char **argv) demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT)); demo.AddExample(Example("animated-shapes.example", DALI_DEMO_STR_TITLE_ANIMATED_SHAPES)); demo.AddExample(Example("path-animation.example", DALI_DEMO_STR_TITLE_PATH_ANIMATION)); + + // Start the event loop app.MainLoop(); return 0; diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 150f945..9a8a2db 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -22,6 +22,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include "shared/view.h" @@ -216,6 +217,10 @@ void DaliTableView::SortAlphabetically( bool sortAlphabetically ) void DaliTableView::Initialize( Application& application ) { + // Provide the stylesheet + StyleManager styleManager = StyleManager::Get(); + styleManager.RequestThemeChange( DALI_DEMO_THEME_PATH ); + Stage::GetCurrent().KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent ); const Vector2 stageSize = Stage::GetCurrent().GetSize(); @@ -492,6 +497,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit TextLabel label = TextLabel::New(); label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); label.SetSize( parentSize ); + label.SetProperty( Control::Property::STYLE_NAME, "launcherlabel" ); label.SetProperty( TextLabel::Property::MULTI_LINE, true ); label.SetProperty( TextLabel::Property::TEXT, title ); label.SetProperty( TextLabel::Property::ALIGNMENT, "CENTER" ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 68605eb..be85fa8 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -39,6 +39,7 @@ of the capability of the toolkit. %define dali_icon_dir /usr/share/icons/ %define smack_rule_dir /etc/smack/accesses2.d/ %define locale_dir %{dali_app_ro_dir}/res/locale +%define local_style_dir ../../resources/style/mobile ############################## # Build @@ -52,7 +53,7 @@ LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -fPIC" CXXFLAGS+=" -D_ARCH_ARM_" %endif -cd %{_builddir}/%{name}-%{version}/build/tizen && cmake -DDALI_APP_DIR=%{dali_app_ro_dir} -DLOCALE_DIR=%{locale_dir} . +cd %{_builddir}/%{name}-%{version}/build/tizen && cmake -DDALI_APP_DIR=%{dali_app_ro_dir} -DLOCALE_DIR=%{locale_dir} -DLOCAL_STYLE_DIR=%{local_style_dir} . make %{?jobs:-j%jobs} @@ -110,6 +111,7 @@ exit 0 %{dali_app_ro_dir}/images/* %{dali_app_ro_dir}/models/* %{dali_app_ro_dir}/scripts/* +%{dali_app_ro_dir}/style/* %{dali_xml_file_dir}/%{name}.xml %{dali_icon_dir}/* %{locale_dir}/* diff --git a/resources/style/demo-theme.json b/resources/style/demo-theme.json new file mode 100644 index 0000000..47e0e3d --- /dev/null +++ b/resources/style/demo-theme.json @@ -0,0 +1,53 @@ +/* +Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved + +This file is part of Dali Toolkit + +PROPRIETARY/CONFIDENTIAL + +This software is the confidential and proprietary information of +SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +disclose such Confidential Information and shall use it only in +accordance with the terms of the license agreement you entered +into with SAMSUNG ELECTRONICS. + +SAMSUNG make no representations or warranties about the suitability +of the software, either express or implied, including but not limited +to the implied warranties of merchantability, fitness for a particular +purpose, or non-infringement. SAMSUNG shall not be liable for any +damages suffered by licensee as a result of using, modifying or +distributing this software or its derivatives. +*/ + +{ + "styles": + { + "textlabel": + { + "font-family":"HelveticaNeue", + "font-style":"Regular" + }, + + "launcherlabel": + { + "point-size":18 + }, + + "toolbarlabel": + { + "point-size":18 + }, + + "textfield": + { + "font-family":"HelveticaNeue", + "font-style":"Regular", + "point-size":18 + }, + + "scrollview": + { + "overshoot-effect-color":"B018" + } + } +} diff --git a/resources/style/mobile/demo-theme.json b/resources/style/mobile/demo-theme.json new file mode 100644 index 0000000..88d2b67 --- /dev/null +++ b/resources/style/mobile/demo-theme.json @@ -0,0 +1,94 @@ +/* +Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved + +This file is part of Dali Toolkit + +PROPRIETARY/CONFIDENTIAL + +This software is the confidential and proprietary information of +SAMSUNG ELECTRONICS ("Confidential Information"). You shall not +disclose such Confidential Information and shall use it only in +accordance with the terms of the license agreement you entered +into with SAMSUNG ELECTRONICS. + +SAMSUNG make no representations or warranties about the suitability +of the software, either express or implied, including but not limited +to the implied warranties of merchantability, fitness for a particular +purpose, or non-infringement. SAMSUNG shall not be liable for any +damages suffered by licensee as a result of using, modifying or +distributing this software or its derivatives. +*/ + +{ + "styles": + { + "textlabel": + { + "font-family":"SamsungSans", + "font-style":"Regular" + }, + + "textlabel-font-size-0": + { + "point-size":8 + }, + "textlabel-font-size-1": + { + "point-size":10 + }, + "textlabel-font-size-2": + { + "point-size":15 + }, + "textlabel-font-size-3": + { + "point-size":19 + }, + "textlabel-font-size-4": + { + "point-size":25 + }, + + "launcherlabel": + { + "point-size":10 + }, + + "toolbarlabel": + { + "point-size":10 + }, + + "textfield": + { + "font-family":"SamsungSans", + "font-style":"Regular" + }, + + "textfield-font-size-0": + { + "point-size":10 + }, + "textfield-font-size-1": + { + "point-size":10 + }, + "textfield-font-size-2": + { + "point-size":10 + }, + "textfield-font-size-3": + { + "point-size":10 + }, + "textfield-font-size-4": + { + "point-size":10 + }, + + "scrollview": + { + "overshoot-effect-color":"B018" + } + } +} diff --git a/shared/view.h b/shared/view.h index 73cb4a2..2a20ba3 100644 --- a/shared/view.h +++ b/shared/view.h @@ -95,11 +95,9 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, label.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); label.SetSize( stage.GetSize().width, style.mToolBarHeight ); label.SetDrawMode( Dali::DrawMode::OVERLAY ); + label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::TEXT, title ); label.SetProperty( Dali::Toolkit::TextLabel::Property::ALIGNMENT, "CENTER" ); - label.SetProperty( Dali::Toolkit::TextLabel::Property::FONT_FAMILY, DEFAULT_TEXT_STYLE_FONT_FAMILY ); - label.SetProperty( Dali::Toolkit::TextLabel::Property::FONT_STYLE, DEFAULT_TEXT_STYLE_FONT_STYLE ); - label.SetProperty( Dali::Toolkit::TextLabel::Property::POINT_SIZE, ScalePointSize(DEFAULT_TEXT_STYLE_POINT_SIZE) ); label.SetColor( DEFAULT_TEXT_STYLE_COLOR ); toolBarLayer.Add( label ); }