From: Amlan Chowdhury Date: Tue, 4 Oct 2016 05:11:39 +0000 (+0600) Subject: [TBT][tizen_3.0_mobile][TBT dali updated, Info Instructions for dali added, tpk updat... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F90728%2F1;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tizen_3.0_mobile][TBT dali updated, Info Instructions for dali added, tpk updated with latest sdk] Signed-off-by: Amlan Chowdhury Change-Id: I98a689c2157913089f50a03859b01719a245c878 --- diff --git a/release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk index 1e8d18d..ff746df 100644 Binary files a/release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.coretbt_dataprovider-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk index 0812199..7d2119c 100644 Binary files a/release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.coretbt_serviceapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk index 30551bc..5682cea 100644 Binary files a/release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.coretbt_uiapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk index 7ec5795..430e172 100644 Binary files a/release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.coretbtwidgetapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk index 734f64d..830a448 100644 Binary files a/release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.operationpickviewapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk index d17d3fc..6cdb119 100644 Binary files a/release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbt-ime-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index 40141fd..078da43 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk index 8a9ba94..cc8e70e 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk differ diff --git a/release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-i386.tpk b/release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-i386.tpk index 97ec566..ee17cd5 100644 Binary files a/release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.coretbt_dataprovider-1.0.0-i386.tpk differ diff --git a/release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-i386.tpk index 2d15baa..373d79a 100644 Binary files a/release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.coretbt_serviceapp-1.0.0-i386.tpk differ diff --git a/release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-i386.tpk index d3179b8..c36bcb1 100644 Binary files a/release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.coretbt_uiapp-1.0.0-i386.tpk differ diff --git a/release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-i386.tpk index bb04c73..2e22de8 100644 Binary files a/release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.coretbtwidgetapp-1.0.0-i386.tpk differ diff --git a/release/binary-x86/org.tizen.operationpickviewapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.operationpickviewapp-1.0.0-i386.tpk index ccd35e9..1fa202e 100644 Binary files a/release/binary-x86/org.tizen.operationpickviewapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.operationpickviewapp-1.0.0-i386.tpk differ diff --git a/release/binary-x86/org.tizen.tbt-ime-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbt-ime-1.0.0-i386.tpk index 2bfcfcb..fa261bc 100644 Binary files a/release/binary-x86/org.tizen.tbt-ime-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbt-ime-1.0.0-i386.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk index 39d47bb..4860eb0 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-i386.tpk index 72b52ff..0574c69 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-i386.tpk differ diff --git a/tbtcoreapp-dali/.sdk_delta.info b/tbtcoreapp-dali/.sdk_delta.info index 5838cbf..12f35f8 100644 Binary files a/tbtcoreapp-dali/.sdk_delta.info and b/tbtcoreapp-dali/.sdk_delta.info differ diff --git a/tbtcoreapp-dali/.sign/.manifest.tmp b/tbtcoreapp-dali/.sign/.manifest.tmp index fb22f11..43615a3 100644 --- a/tbtcoreapp-dali/.sign/.manifest.tmp +++ b/tbtcoreapp-dali/.sign/.manifest.tmp @@ -1,5 +1,7 @@ -bin/tbtcoreapp-dali__DEL__wkhOn6RMHAv/tOa6sOHAmW4qIHT7W+J5YX6UQu/T0Lk= +bin/tbtcoreapp-dali__DEL__BwnvgG8sD2EdRtBUa5HwwaS60PEqE7+CWAcAtTppgG4= +res/dali-toolkit-test-theme_720x1280.json__DEL__DCzB9UIk8miYUX+Ll21N0W0mefzt37DPTsrTRPo4PfE= res/images/Default_home.png__DEL__G5tVggT06pLAhU2qhwPAmVTMSNTBF3T5sqkIydsMt44= +res/images/customTextFieldBgImage.jpg__DEL__tRuXc9qO5C064IhIkuWVtgw2OiQ1R6sCYm0KA+AbmGU= res/images/gallery-medium-1.jpg__DEL__7dleUp5WKUt0OJMqXojKT/IVBavHjV9f0mxhu3pSc9c= res/images/gallery-medium-10.jpg__DEL__qH3s0+E6NUWB71kIVH7g+7XN9zB8yiDkHs25BUSdcVE= res/images/gallery-medium-11.jpg__DEL__1pVoowD12oHFSP/pChB35fUoKFn+A8e/MQjsV5dN2Sk= @@ -14,8 +16,10 @@ res/images/gallery-medium-6.jpg__DEL__8yF/sif0ToURXN5N3lzq0ji1b9pG3jsc0AwWzPGinX res/images/gallery-medium-7.jpg__DEL__gNI6SHFx54CgGGAFtjq+GtGtjyMWEt5qoKjfcPOaToQ= res/images/gallery-medium-8.jpg__DEL__o/rU2msAJGacK+FqGF/pOR9/QK9m5YZ9kIaKRgC8OsU= res/images/gallery-medium-9.jpg__DEL__L2DUpdIZ/yaAsDTJsGEx87dETx/Om8CSRFwTt6IWe6A= +res/images/innerButtonSelected.png__DEL__PzQHYcMYkp+kGOk5VbcgJNlKdqT2Xzvo2hsW5zlJGug= +res/images/innerButtonUnselected.png__DEL__WL6GQSbZZ+QqJKmKngw+hDUwwaV+xuVk9jAL+uXapIg= res/images/text-field-bg.9.png__DEL__MB7LhGWONfE9F3kWbkkHJNgQ4SIfT3U+WND+9+siVpU= res/images/top-bar.png__DEL__gvQ+T+R9lVRmJmRoRaYoeIHhzxEwsXgRSr4wjnbEokM= shared/res/tbtcoreapp-dali.png__DEL__1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs= tizen-manifest.xml__DEL__jVCHDxVZ/eHQqLpBXF33+IyKIcQTWevk9pMnSecwrsE= -author-signature.xml__DEL__Fpm9FhlqYK2Cda3P6YRbDLH9EUWur05uPu6A5AUK1Ic= +author-signature.xml__DEL__aJEorr20NN+WLYn8DIR0+RRSoK54vR8nvGNhsBxATIQ= diff --git a/tbtcoreapp-dali/.sign/author-signature.xml b/tbtcoreapp-dali/.sign/author-signature.xml index 62ec859..41a554e 100644 --- a/tbtcoreapp-dali/.sign/author-signature.xml +++ b/tbtcoreapp-dali/.sign/author-signature.xml @@ -4,12 +4,20 @@ -wkhOn6RMHAv/tOa6sOHAmW4qIHT7W+J5YX6UQu/T0Lk= +BwnvgG8sD2EdRtBUa5HwwaS60PEqE7+CWAcAtTppgG4= + + + +DCzB9UIk8miYUX+Ll21N0W0mefzt37DPTsrTRPo4PfE= G5tVggT06pLAhU2qhwPAmVTMSNTBF3T5sqkIydsMt44= + + +tRuXc9qO5C064IhIkuWVtgw2OiQ1R6sCYm0KA+AbmGU= + 7dleUp5WKUt0OJMqXojKT/IVBavHjV9f0mxhu3pSc9c= @@ -66,6 +74,14 @@ L2DUpdIZ/yaAsDTJsGEx87dETx/Om8CSRFwTt6IWe6A= + + +PzQHYcMYkp+kGOk5VbcgJNlKdqT2Xzvo2hsW5zlJGug= + + + +WL6GQSbZZ+QqJKmKngw+hDUwwaV+xuVk9jAL+uXapIg= + MB7LhGWONfE9F3kWbkkHJNgQ4SIfT3U+WND+9+siVpU= @@ -91,25 +107,25 @@ -UvPoaU+CH0/QYAMUw05kxnGYL7khFJuF7/G/RKdxDczZEjxgVSCIcR8+lgfSiXlmyVIcnNuKL3AD -L3VRZ8+4pFaWX7gyJFeOrvi3bWPwcGJ6VR+LINZNdjpoEOuXX0c97zFblW1eH8xbXyNMPcDhTsHK -A6j0H0dmXYuvkPVJDuU= +C+C+QgCk1L/TC2zHmWqj+u1dZtgLVdElydmQJXPlYIzFBw0fkFA95kojII4HoyN4W0RjVfqEK47y +LsCrl2kWpU/tEMWuX/sos9kdqZijT6/Gzt5ZZvgvYFlJvxbF3g5J7HOQ5CZ2U2h/sAvU5+ayhnAi +5++vkxr8yyDxh7CQMqk= -MIIClTCCAX2gAwIBAgIGAVXrmUisMA0GCSqGSIb3DQEBBQUAMFYxGjAYBgNVBAoMEVRpemVuIEFz +MIIClTCCAX2gAwIBAgIGAVaU7TxzMA0GCSqGSIb3DQEBBQUAMFYxGjAYBgNVBAoMEVRpemVuIEFz c29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4gRGV2 ZWxvcGVycyBDQTAeFw0xMjExMDEwMDAwMDBaFw0xOTAxMDEwMDAwMDBaMBExDzANBgNVBAMMBmF1 -dGhvcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAyoHkef9LjRgrl+wrQNXmYTP2FnWzyzrL -y3J+hXNgmKWGRgAh/f/GEGKi8pG8QMXh099Zj4diHsBkk5eVXLi5iAU9QF5Uhqjyv20Wtb5pbEQC -mzfN94iGamWkSjMe8lDsujd1jQZ4Wnsh3/zrjXzpjMqlM5h35gSjPPIxBhVgQoECAwEAAaMyMDAw +dGhvcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAl7hQZEvuy8qFP+j/h/AKXAaO/H1Kv98w +iDuu35EgiBkQwm0LkhY29csiO8ii5dN/8qKaYs7f6rUlfmROXm13QLSOPCadEzt8lm7Z4oPCXWl1 +1guSBLiPubuuH3HFg4PkPG/Mg0RcUD4UiuqUgYFEdRoPFarq3dpGpXEHkvvCE4ECAwEAAaMyMDAw DAYDVR0TAQH/BAIwADALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcN -AQEFBQADggEBAAHOUFgpCEmxp1TOxJNJ+/z0v2aJj/GA4iIW0qjG1YxLQlgBhcEjE6Y9EqWw5taj -QF6UWbEJI37Hhiv6j4Ib+/+fVEAkw8McUABcnqoTEGmQ/u9JsCLC1hAk0wATZb3E7cg0PSRf57Ix -7zCPc7HdHBIzMtLI+pw4Ad5C1uPsN/dsyn0iey1sXhouGIGAwjqUaE7G9p9JPDuniV1H+Q6LuOYe -ZV4cXLMvHsj2n15lHdxcJLjZ9cGSGWnGHaSlWbnYzbaiO1V0UKyv+3H2FQO5UwN5fQJSCfjpja4a -txpEP0SiWF9o6fnCf5dYhKNH3kW5VOzNCmzPITvgvxmVdirMKxM= +AQEFBQADggEBADNLE1In6hcib8Rrv7HSRrs7FJoOby3AWILQZv5afg/wWQ2IfjqzZcMh1x7RLlyQ +F+u2fXf0mPEXt038uoOkmXPOZ9AWcxshHEczjy6DTkyYSFq55QsCRxt6A3K3jggAOKmPK1wufXPj +xy4dvDsS3hqfyLnYGKODrdHS0Y2qmj3hoOPFEl3wbYqd3/Zd8jD7aq2uMVjDNfsPpY9sPtK58isQ +0DfTWtJ2FEOUHrVj/gncF3kYL+khSuFbvS+wa4nC2Td7/Kj0YW7G7XnxMOQSFdIGDbfOeHSWYHCD +sOa76yXPmbUSkk98oTeSd9KAzkEiJo12yj8T0KH3PKmJ4Aux2/A= MIIDOTCCAiGgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMRowGAYDVQQKDBFUaXplbiBBc3NvY2lh diff --git a/tbtcoreapp-dali/.sign/signature1.xml b/tbtcoreapp-dali/.sign/signature1.xml index 476a80b..e21c9a0 100644 --- a/tbtcoreapp-dali/.sign/signature1.xml +++ b/tbtcoreapp-dali/.sign/signature1.xml @@ -4,16 +4,24 @@ -Fpm9FhlqYK2Cda3P6YRbDLH9EUWur05uPu6A5AUK1Ic= +aJEorr20NN+WLYn8DIR0+RRSoK54vR8nvGNhsBxATIQ= -wkhOn6RMHAv/tOa6sOHAmW4qIHT7W+J5YX6UQu/T0Lk= +BwnvgG8sD2EdRtBUa5HwwaS60PEqE7+CWAcAtTppgG4= + + + +DCzB9UIk8miYUX+Ll21N0W0mefzt37DPTsrTRPo4PfE= G5tVggT06pLAhU2qhwPAmVTMSNTBF3T5sqkIydsMt44= + + +tRuXc9qO5C064IhIkuWVtgw2OiQ1R6sCYm0KA+AbmGU= + 7dleUp5WKUt0OJMqXojKT/IVBavHjV9f0mxhu3pSc9c= @@ -70,6 +78,14 @@ L2DUpdIZ/yaAsDTJsGEx87dETx/Om8CSRFwTt6IWe6A= + + +PzQHYcMYkp+kGOk5VbcgJNlKdqT2Xzvo2hsW5zlJGug= + + + +WL6GQSbZZ+QqJKmKngw+hDUwwaV+xuVk9jAL+uXapIg= + MB7LhGWONfE9F3kWbkkHJNgQ4SIfT3U+WND+9+siVpU= @@ -95,9 +111,9 @@ -VZwWJDuKjP/4l6TK0NEe//Af5D3cNHYFNsrpZltCPS4CKNi8E6/vrWd6kGXcoo1JHS8zzihxtQFM -IqIIQfeT+seyXOyMpOpBbtl1Aa7P9JOxTijwy64o7ZoS5ZIEWlPS8kQfTzrx1nU8A7knA96350YJ -exw6tibTyPgmNTpwfdw= +aaFq6x6BIxcsRkaSqx7eL3b+qPs7NgRPZzU+LS7HT04lFCPZMuLq2kLvbSo5XwhM1V8gQdBz9xYO +ey9FyQg4/mJ/85xRu1Af7v4q0N9xwT7huqNfyqOs8QDj2O+q05ab0bP/OTKjLvd+P6eoguwDdevN +jxOP52U4qNOsipizpjA= diff --git a/tbtcoreapp-dali/inc/utils/constrants.h b/tbtcoreapp-dali/inc/utils/constrants.h new file mode 100644 index 0000000..2ffa9e7 --- /dev/null +++ b/tbtcoreapp-dali/inc/utils/constrants.h @@ -0,0 +1,24 @@ +/* + * constrants.h + * + * Created on: Sep 1, 2016 + * Author: jahangir + */ + +#ifndef CONSTRANTS_H_ +#define CONSTRANTS_H_ +#include +using namespace Dali; + +#define TEXTLABEL_HEIGHT 0.0625f // assume full screen width 1 and height 1. 0.0625 is 1/16 +#define TEXTFIELD_HEIGHT 0.0625f // assume full screen width 1 and height 1. 0.0625 is 1/16 +#define TEXTEDITOR_HEIGHT 0.08333f // assume full screen width 1 and height 1. 0.0625 is 1/12 +#define BUTTON_HEIGHT 0.125f // assume full screen width 1 and height 1. 0.125 is 1/8 +#define VERTICAL_SPACE 0.00781f // assume full screen width 1 and height 1. 0.125 is 1/128 +#define HORIZONTAL_SPACE 0.00781f // assume full screen width 1 and height 1. 0.125 is 1/128 + +const Vector4 selectedColor=Vector4(0.55f, 0.8f, 0.9f, 1.0f); +const Vector4 unSelectedColor=Vector4(0.8f, 0.9f, 0.9f, 1.0f); + + +#endif /* CONSTRANTS_H_ */ diff --git a/tbtcoreapp-dali/inc/utils/dali-ui-utils.h b/tbtcoreapp-dali/inc/utils/dali-ui-utils.h index 0e8f811..ffedb6f 100644 --- a/tbtcoreapp-dali/inc/utils/dali-ui-utils.h +++ b/tbtcoreapp-dali/inc/utils/dali-ui-utils.h @@ -1,22 +1,6 @@ -/******************************************************************************* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ - /** * @file dali-ui-utils.h - * @brief This file provide necessary Util functions UI. + * @brief This file provide necessary Util functions of UI. * @since_tizen 3.0 * @author Jahangir Alam (ja.alam@samsung.com) * @date July, 2016 @@ -24,10 +8,95 @@ * @credit */ -#ifndef __DALI_UI_UTILS_H__ -#define __DALI_UI_UTILS_H__ +#ifndef DALI_UI_UTILS_H_ +#define DALI_UI_UTILS_H_ + #include +#include +#include +#include +#include +#include "logger.h" +#include +#include "utils/constrants.h" +#include "utils/type-cast.h" + +//global function void get_screen_height_width(const char *key, int *value); -#endif /* __DALI_UI_UTILS_H__ */ +using namespace Dali; +using namespace Dali::Toolkit; +using namespace std; + + +class UiUtils : public ConnectionTracker +{ + +public: + UiUtils(Application& application, app_control_h app_control); +public: + + Vector2 headerSize; + Vector2 bodySize; + Vector2 footerSize; + + TextLabel lbtTitle; + + Control ctlRoot; + Control ctlHeader; + Control ctlBody; + Control ctlFooter; + Control ctlInfo; + + PushButton btnPassButton; + PushButton btnFailButton; + PushButton btnInfoButton; + + TableView tblVerdict; + + Application& mApplication; + app_control_h _control; + + bool bflag; + std::string mAppResourcePath; + std::string mImageDirectory; + std::string mInfoText; + +public: + void Init(std::string title); + + template + PushButton CreateVerdictButton(TableView parent, TableView::CellPosition cellPosition, + Vector3 anchorPoint, Vector2 position, std::string label, X* obj, + Ret (X::*onClickedCallback)(Arg0 arg0), + Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); + + //template + PushButton CreateButton(Vector3 anchorPoint, Vector2 position, std::string label,/* X* obj, + Ret (X::*onClickedCallback)(Arg0 arg0),*/ Vector4 selectedColor, + Vector4 unselectedColor, Vector2 size); + + TextLabel CreateTextLabel(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size ); + + //template + Control CreateTextField(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size/*, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0)*/ ); + + //template + Control CreateTextEditor(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size/*, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0)*/ ); + + void CreateLabelList(Property::Map keyMap, Property::Map sizeMap); + + void FillInfoPage(std::string content); + + bool OnPassButtonClick(Button button); + bool OnFailButtonClick(Button button); + bool OnInfoButtonClick(Button button); + void OnKeyEvent( const KeyEvent& event ); +}; + + +#endif /* DALI_UI_UTILS_H_ */ diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-accessibility-manager-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-accessibility-manager-view.h index 09a5e44..68e4b73 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-accessibility-manager-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-accessibility-manager-view.h @@ -5,27 +5,19 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +//#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliAccessibilityManagerView: public CommonView { +class TBTDaliAccessibilityManagerView: public UiUtils { private: AccessibilityManager mAccessibilityManager; - TableView mrootTable; - TextLabel lblActionActivate; - PushButton btn1; - PushButton btn2; + PushButton btnUp; + PushButton btnDown; public: TBTDaliAccessibilityManagerView(Application& mApplication, app_control_h _control); - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); - bool OnClick(Button button); bool OnAccessibilityActionSignalType( AccessibilityManager& manager ); bool OnActionNextSignal(AccessibilityManager& manager); diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-actor-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-actor-view.h index 6e3fa82..a486ba9 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-actor-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-actor-view.h @@ -7,36 +7,30 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliActorView: public CommonView { +class TBTDaliActorView: public UiUtils { public: TBTDaliActorView(Application& mApplication, app_control_h _control); //signal bool cbTouchedSignal(Actor actor, const TouchEvent& event); - bool cbTouchSignal(Actor actor, const TouchData& data); bool cbHoveredSignal(Actor actor, const HoverEvent& event); bool cbWheelEventSignal(Actor actor, const WheelEvent& event); bool cbButtonClicked(Button button); - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition,Vector3 anchorPoint, - Vector3 position, std::string txt, Vector2 size ); private: + + //textlabel TextLabel txtTouched; TextLabel txtTouchEventData; - TextLabel txtTouch; - TextLabel txtTouchData; TextLabel txtHovered; TextLabel txtHoveredData; TextLabel txtWheel; + //button PushButton btnButton; }; diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-app-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-app-view.h new file mode 100644 index 0000000..1ac2fb4 --- /dev/null +++ b/tbtcoreapp-dali/inc/view/tbt-dali-app-view.h @@ -0,0 +1,51 @@ +#ifndef __TBT_MODULE_APP_DALI_APP +#define __TBT_MODULE_APP_DALI_APP +#include + +#include "utils/logger.h" +#include "utils/config.h" +#include "utils/ui-utils.h" +#include "utils/dali-ui-utils.h" + +class TBTDaliAppView: public UiUtils { + +private: + + TextLabel lblTerminateSignal; + TextLabel lblPauseSignal; + TextLabel lblIdleSignal; + TextLabel lblAppControlSignal; + TextLabel lblBatteryLowSignal; + TextLabel lblLanguageChangedSignal; + TextLabel lblMemoryLowSignal; + TextLabel lblRegionChangedSignal; + TextLabel lblResetSignal; + TextLabel lblResumeSignal; + TextLabel lblResizeSignal; + +// PushButton btnLower; +// PushButton btnReset; +// PushButton btnResize; + +public: + TBTDaliAppView(Application& mApplication, app_control_h _control); + + void onContextLost(); + void onContextRegain(); + bool lowerButtonClicked(Button); + bool resetButtonClicked(Button); + bool resizeButtonClicked(Button); + void OnTerminate(Application& app); + void OnPause(Application& app); + void OnIdle(); + void OnApplicationBatteryLowSignalCallback(Application& app); + void OnApplicationLanguageChangedSignalCallback(Application&); + void OnApplicationMemoryLowSignalCallback(Application& app); + void OnApplicationRegionChangedSignalCallback(Application& app); + void OnApplicationResetSignalCallback(Application& app); + void OnApplicationResumeSignalCallback(Application& app); + void OnApplicationResizeSignalCallback(Application& app); +}; + +#endif // __TBT_MODULE_APP_DALI_APP + diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-button-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-button-view.h index 96f8af4..da4962e 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-button-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-button-view.h @@ -5,26 +5,23 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliButtonView: public CommonView { +class TBTDaliButtonView: public UiUtils { private: - TableView mrootTable; + + //textlabel TextLabel txtClick; TextLabel txtPress; TextLabel txtRelease; + + //button PushButton btnTest; public: TBTDaliButtonView(Application& mApplication, app_control_h _control); - - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); + //signal bool onClicked(Button button); bool onPressed(Button button); bool onReleased(Button button); diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-common-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-common-view.h deleted file mode 100644 index e6c37c1..0000000 --- a/tbtcoreapp-dali/inc/view/tbt-dali-common-view.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __TBT_MODULE_APP_DALI_COMMON -#define __TBT_MODULE_APP_DALI_COMMON - -#include -#include -#include "utils/logger.h" -#include "utils/ui-utils.h" -#include "utils/config.h" -#include "utils/dali-ui-utils.h" -#include "utils/type-cast.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -class CommonView: public ConnectionTracker { - -public: - Application mApplication; -private: - PushButton passButton; - PushButton failButton; - PushButton infoButton; - float verdictTableHeight; - app_control_h _control; -public: - CommonView(Application& mApplication, app_control_h _control); - - virtual void Initialize(); - - float GetVerdictTableHeight(); - - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - - TextField CreateTextField(const Vector2& size, const std::string& text); - - virtual bool OnPassButtonClicked(Button button); - - virtual bool OnFailButtonClicked(Button button); - - virtual bool OnInfoButtonClicked(Button button); - - virtual bool OnTouch(Actor actor, const TouchEvent& event); - - virtual void OnKeyEvent(const KeyEvent& event); - - float GetScreenHeight(); - float GetScreenWidth(); -}; - -#endif //__TBT_MODULE_APP_DALI_COMMON diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-gesture-detector-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-gesture-detector-view.h index e21fed6..2caaaa6 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-gesture-detector-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-gesture-detector-view.h @@ -5,12 +5,12 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliGestureDetectorView: public CommonView { +class TBTDaliGestureDetectorView: public UiUtils { private: - TableView mrootTable; + //testlabel TextLabel lblLongPress; TextLabel lblPinch; TextLabel lblpan; @@ -20,18 +20,10 @@ private: PanGestureDetector panGesture; public: TBTDaliGestureDetectorView(Application& mApplication, app_control_h _control); - - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); - + //signal void OnLongPressGestureDetector(Actor actor, const LongPressGesture& gesture); void OnPinchGestureDetector(Actor actor, const PinchGesture& gesture); void OnPanGestureDetector(Actor actor, const PanGesture& gesture); - }; #endif // __TBT_MODULE_APP_DALI_GESTURE_DETECTOR diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-keyboard-focus-manager-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-keyboard-focus-manager-view.h index 7256d41..c8d220f 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-keyboard-focus-manager-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-keyboard-focus-manager-view.h @@ -5,14 +5,12 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliKeyBoardFocusManagerView: public CommonView { +class TBTDaliKeyBoardFocusManagerView: public UiUtils { private: KeyboardFocusManager mFocusManager; - ItemView mItemView; - TableView mrootTable; TextLabel lblPreFocus; TextLabel lblFocusChange; @@ -22,25 +20,22 @@ private: PushButton btnUp; PushButton btnDown; - TextField txt1; - TextEditor txt2; + TextField txt_field; + TextEditor txt_editor; public: TBTDaliKeyBoardFocusManagerView(Application& mApplication, app_control_h _control); - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); - Actor OnPreFocusChange(Actor current, Actor proposed, Control::KeyboardFocus::Direction direction); void OnFocusChanged(Actor current, Actor proposed); void OnFocusGroupChanged(Actor actor, bool bValue); void OnFocusedActorEnterKey(Actor actor); bool OnUpClick(Button button); bool OnDownClick(Button button); + void onTextChanged(TextEditor editor); + bool onKeyEventSignal(Control control, const KeyEvent& event); + bool OnButtonClick(Button button); + bool OnButtonClick_1(Button button); }; #endif // __TBT_MODULE_APP_DALI_KEY_BOARD_FOCUS_MANAGER diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-scroll-bar-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-scroll-bar-view.h deleted file mode 100644 index d19a958..0000000 --- a/tbtcoreapp-dali/inc/view/tbt-dali-scroll-bar-view.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __TBT_MODULE_APP_DALI_SCROLL_BAR -#define __TBT_MODULE_APP_DALI_SCROLL_BAR -#include - -#include "utils/logger.h" -#include "utils/config.h" -#include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" - -class TBTDaliScrollBarView: public CommonView { - -private: - TableView mrootTable; - TextLabel lblScrollBar; - ScrollBar scrollBar; - TextEditor txtEditor; -public: - TBTDaliScrollBarView(Application& mApplication, app_control_h _control); - - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); - void OnPanFinishedSignal(); -}; - -#endif // __TBT_MODULE_APP_DALI_SCROLL_BAR - diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-scroll-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-scroll-view.h index d93815b..dedcfc7 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-scroll-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-scroll-view.h @@ -7,9 +7,9 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliScrollView: public CommonView { +class TBTDaliScrollView: public UiUtils { private: char* IMAGE_PATHS[14]; diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-slider-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-slider-view.h index f12accf..dc11c02 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-slider-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-slider-view.h @@ -5,27 +5,22 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliSliderView: public CommonView { +class TBTDaliSliderView: public UiUtils { private: - TableView mrootTable; - TextLabel txtValue; + //textlabel + //TextLabel txtValue; TextLabel txtValueChanged; TextLabel txtFinished; TextLabel txtMarkReached; + Slider slider; public: TBTDaliSliderView(Application& mApplication, app_control_h _control); - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); bool onValueChanged(Slider slider,float value); bool onSliningFinished(Slider slider,float value); bool onMarkReached(Slider slider,int value); diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-stage-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-stage-view.h index ec036ff..f477855 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-stage-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-stage-view.h @@ -5,12 +5,12 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliStageView: public CommonView { +class TBTDaliStageView: public UiUtils { private: - TableView mrootTable; + //textlabel TextLabel txtContext; TextLabel txtContextRegain; TextLabel txtEventProcessing; @@ -19,33 +19,29 @@ private: TextLabel txtTouched; TextLabel txtTouch; TextLabel txtWheel; + PushButton btnTestButton; PushButton textButton; + bool bCheck; // Atlas mAtlas; Toolkit::ImageView imageView; public: TBTDaliStageView(Application& mApplication, app_control_h _control,std::string msg); - - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); - + //signal void onKeyEvent(const KeyEvent& keyevent); void onEventProcessing(); void onTouchedEvent(const TouchEvent& touchevent); void onTouchEvent(const TouchData& touchdata); bool onWheelEvent(Actor actor, const WheelEvent& wheelevent); + void onStageWheelEvent( const WheelEvent& wheelevent); void onContextLost(); void onContextRegain(); void onSceneCreated(); bool OnButtonClicked(Button button); -// BufferImage TBTDaliStageView::CreateBufferImage( const Vector4& color, const unsigned int width, const unsigned int height ); -// PixelData TBTDaliStageView::CreatePixelData( const Vector3& color, const unsigned int width, const unsigned int height ); + bool OnButtonClick(Button button); + static void NewWindow(void); }; diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-style-manager-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-style-manager-view.h index 1571736..211de6c 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-style-manager-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-style-manager-view.h @@ -5,24 +5,17 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliStyleManagerView: public CommonView { +class TBTDaliStyleManagerView: public UiUtils { private: - TableView mrootTable; TextLabel lblStyleManager; PushButton btnStyle; StyleManager styleManager; public: TBTDaliStyleManagerView(Application& mApplication, app_control_h _control); - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); void OnStyleChange(StyleManager style,StyleChange::Type type); bool OnClicked(Button button); }; diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-text-control-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-text-control-view.h index 9cb5495..531ad54 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-text-control-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-text-control-view.h @@ -5,31 +5,29 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliTextControlView: public CommonView { +class TBTDaliTextControlView: public UiUtils { private: - TableView mrootTable; + TextLabel lblField; TextLabel lblEditor; TextLabel lblKeyEvent; TextField txtField; TextEditor txtEditor; + TextEditor editor; + TextField field; public: TBTDaliTextControlView(Application& mApplication, app_control_h _control); - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); void onMaxLengthReached(TextField field); void onTextChanged(TextEditor editor); bool onKeyEventSignal(Control control, const KeyEvent& event); + bool OnButtonClick(Button button); + bool OnButtonClick1(Button button); }; #endif // __TBT_MODULE_APP_DALI_TEXT_CONTROL diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-touch-data-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-touch-data-view.h index eda4301..18fd96f 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-touch-data-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-touch-data-view.h @@ -5,24 +5,16 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" +#include "utils/dali-ui-utils.h" -class TBTDaliTouchDataView: public CommonView { +class TBTDaliTouchDataView: public UiUtils { private: - TableView mrootTable; TextLabel txtTouch; public: TBTDaliTouchDataView(Application& mApplication, app_control_h _control); - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - TextLabel CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ); - void onTouchEvent(const TouchData& touchdata); }; diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-tts-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-tts-view.h index fa9b185..536a845 100644 --- a/tbtcoreapp-dali/inc/view/tbt-dali-tts-view.h +++ b/tbtcoreapp-dali/inc/view/tbt-dali-tts-view.h @@ -5,34 +5,26 @@ #include "utils/logger.h" #include "utils/config.h" #include "utils/ui-utils.h" -#include "view/tbt-dali-common-view.h" -#include "view/tbt-dali-tts-view.h" +#include "utils/dali-ui-utils.h" -class TBTTTSView: public CommonView { +class TBTTTSView: public UiUtils { private: PushButton playButton; PushButton interruptButton; PushButton stopButton; - TextField txt; + TextLabel lblTTS; + TextField txtTTS; TtsPlayer tts; public: TBTTTSView(Application& mApplication, app_control_h _control); - template - PushButton CreateButton(TableView parent, TableView::CellPosition cellPosition, Vector3 anchorPoint, - Vector3 position, std::string label, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0), - Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); - void updateViewControls(); - virtual bool OnPlayButtonClicked(Button button); - virtual bool OnInterruptButtonClicked(Button button); - virtual bool OnStopButtonClicked(Button button); - + bool OnButtonClick(Button button); }; #endif // __TBT_MODULE_APP_DALI_TTS diff --git a/tbtcoreapp-dali/res/dali-toolkit-test-theme_720x1280.json b/tbtcoreapp-dali/res/dali-toolkit-test-theme_720x1280.json index d07b4b6..d3645a5 100644 --- a/tbtcoreapp-dali/res/dali-toolkit-test-theme_720x1280.json +++ b/tbtcoreapp-dali/res/dali-toolkit-test-theme_720x1280.json @@ -3,8 +3,8 @@ { "textlabel": { - "fontStyle":"Italy", - "pointSize":18 + "fontStyle":"italic", + "pointSize":12 }, "testbutton": { diff --git a/tbtcoreapp-dali/res/images/customTextFieldBgImage.jpg b/tbtcoreapp-dali/res/images/customTextFieldBgImage.jpg new file mode 100644 index 0000000..85776e3 Binary files /dev/null and b/tbtcoreapp-dali/res/images/customTextFieldBgImage.jpg differ diff --git a/tbtcoreapp-dali/res/images/innerButtonSelected.png b/tbtcoreapp-dali/res/images/innerButtonSelected.png new file mode 100644 index 0000000..eae282c Binary files /dev/null and b/tbtcoreapp-dali/res/images/innerButtonSelected.png differ diff --git a/tbtcoreapp-dali/res/images/innerButtonUnselected.png b/tbtcoreapp-dali/res/images/innerButtonUnselected.png new file mode 100644 index 0000000..657da96 Binary files /dev/null and b/tbtcoreapp-dali/res/images/innerButtonUnselected.png differ diff --git a/tbtcoreapp-dali/src/tbtcoreapp-dali.cpp b/tbtcoreapp-dali/src/tbtcoreapp-dali.cpp index d1fbc29..90e6487 100644 --- a/tbtcoreapp-dali/src/tbtcoreapp-dali.cpp +++ b/tbtcoreapp-dali/src/tbtcoreapp-dali.cpp @@ -3,7 +3,6 @@ #include #include #include "utils/logger.h" -#include "view/tbt-dali-common-view.h" #include "view/tbt-dali-actor-view.h" #include "view/tbt-dali-stage-view.h" #include "view/tbt-dali-tts-view.h" @@ -16,7 +15,7 @@ #include "view/tbt-dali-accessibility-manager-view.h" #include "view/tbt-dali-gesture-detector-view.h" #include "view/tbt-dali-style-manager-view.h" -//#include "view/tbt-dali-scroll-bar-view.h" +#include "view/tbt-dali-app-view.h" using namespace Dali; using namespace Dali::Toolkit; @@ -33,7 +32,6 @@ public: DBG(">>>>>>In DaliTestController"); mApplication.InitSignal().Connect( this, &DaliTestController::Create ); mApplication.AppControlSignal().Connect(this, &DaliTestController::AppControl); - cView = NULL; moduleName = NULL; msg=""; } @@ -47,10 +45,11 @@ public: { DBG(">>>>>>In Create"); // Get a handle to the stage - Stage stage = Stage::GetCurrent(); -// stage.GetRootLayer().TouchedSignal().Connect( this, &DaliTestController::OnTouch ); - stage.KeyEventSignal().Connect( this, &DaliTestController::OnKeyEvent ); - stage.SceneCreatedSignal().Connect( this, &DaliTestController::onSceneCreated ); + //Stage stage = Stage::GetCurrent(); + //stage.GetRootLayer().TouchedSignal().Connect( this, &DaliTestController::OnTouch ); + //stage.KeyEventSignal().Connect( this, &DaliTestController::OnKeyEvent ); + //stage.SceneCreatedSignal().Connect( this, &DaliTestController::onSceneCreated ); + //this->ApplicationModule(); } void onSceneCreated() { @@ -58,29 +57,6 @@ public: msg="onSceneCreated"; } - bool OnTouch( Actor actor, const TouchEvent& event ) - { - if(cView) - { - return cView->OnTouch(actor, event); - } - return true; - } - - void OnKeyEvent( const KeyEvent& event ) - { - if( event.state == KeyEvent::Down ) - { - // Check if a key event is for a specific DALi key. - // Return true if the key is matched, or return false if not. - if( IsKey( event, DALI_KEY_ESCAPE ) || IsKey( event, DALI_KEY_BACK ) ) - { - // Quit the application - mApplication.Quit(); - } - } - } - void AppControl( Application& application, void* data ) { DBG(">>>>>>In AppControl"); @@ -99,56 +75,56 @@ public: app_control_get_extra_data(app_control, "module_name", &moduleName); if(strcmp(moduleName, "TBT_APP_DALI_TTS") == 0) { - cView = new TBTTTSView(mApplication, _control); + parentView = new TBTTTSView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_SCROLL") == 0) { - cView = new TBTDaliScrollView(mApplication, _control); + parentView = new TBTDaliScrollView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_ACTOR") == 0) { - cView = new TBTDaliActorView(mApplication, _control); + parentView = new TBTDaliActorView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_STAGE") == 0) { - cView = new TBTDaliStageView(mApplication, _control, msg); + parentView = new TBTDaliStageView(mApplication, _control, msg); } else if(strcmp(moduleName, "TBT_APP_DALI_TOUCH_DATA") == 0) { - cView = new TBTDaliTouchDataView(mApplication, _control); + parentView = new TBTDaliTouchDataView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_BUTTON") == 0) { - cView = new TBTDaliButtonView(mApplication, _control); + parentView = new TBTDaliButtonView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_SLIDER") == 0) { - cView = new TBTDaliSliderView(mApplication, _control); + parentView = new TBTDaliSliderView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_TEXT_CONTROL") == 0) { - cView = new TBTDaliTextControlView(mApplication, _control); + parentView = new TBTDaliTextControlView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_KEY_BOARD_FOCUS_MANAGER") == 0) { - cView = new TBTDaliKeyBoardFocusManagerView(mApplication, _control); + parentView = new TBTDaliKeyBoardFocusManagerView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_ACCESSIBILITY_MANAGER") == 0) { - cView = new TBTDaliAccessibilityManagerView(mApplication, _control); + parentView = new TBTDaliAccessibilityManagerView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_GESTURE_DETECTOR") == 0) { - cView = new TBTDaliGestureDetectorView(mApplication, _control); + parentView = new TBTDaliGestureDetectorView(mApplication, _control); } else if(strcmp(moduleName, "TBT_APP_DALI_STYLE_MANAGER") == 0) { - cView = new TBTDaliStyleManagerView(mApplication, _control); + parentView = new TBTDaliStyleManagerView(mApplication, _control); + } + else if(strcmp(moduleName, "TBT_APP_DALI_APP") == 0) + { + parentView = new TBTDaliAppView(mApplication, _control); } -// else if(strcmp(moduleName, "TBT_APP_DALI_SCROLL_BAR") == 0) -// { -// cView = new TBTDaliScrollBarView(mApplication, _control); -// } } } @@ -156,8 +132,14 @@ public: app_control_h _control; Application& mApplication; char* moduleName; - CommonView *cView; + UiUtils *parentView; std::string msg; + + PushButton passButton; + PushButton failButton; + PushButton infoButton; + + //float verdictTableHeight; }; // Entry point for Tizen applications diff --git a/tbtcoreapp-dali/src/utils/dali-ui-utils.cpp b/tbtcoreapp-dali/src/utils/dali-ui-utils.cpp index 45dd758..cf91667 100644 --- a/tbtcoreapp-dali/src/utils/dali-ui-utils.cpp +++ b/tbtcoreapp-dali/src/utils/dali-ui-utils.cpp @@ -1,8 +1,317 @@ +/* + * dali-ui-utils.cpp + * + * Created on: Aug 30, 2016 + * Author: jahangir + */ #include "utils/dali-ui-utils.h" -#include "utils/logger.h" -void get_screen_height_width(const char *key, int *value) +const Vector4 CUSTOM_BLUE_COLOR = Vector4( 66.0f/255.0f, 180.0f/255.0f, 198.0f/255.0f, 1.0f ); +const Vector4 EDITOR_COLOR = Vector4( 214.0f, 234.0f, 248.0f, 1.0f); + +UiUtils::UiUtils(Application& application, app_control_h app_control) : mApplication(application) { - int ret=system_info_get_platform_int (key, value); - if(ret!=SYSTEM_INFO_ERROR_NONE) - DBG("Unable to get screen size."); + DBG("UiUtils::UiUtils...."); + this->bflag=false; + this->mAppResourcePath= app_get_resource_path(); + this->mImageDirectory = this->mAppResourcePath + "images/"; + //this->mApplication=application; + this->_control=app_control; +} +void UiUtils::Init(std::string title) +{ + DBG("UiUtils::Init...."); + Stage stage = Stage::GetCurrent(); + Vector2 stageSize=stage.GetSize(); + stage.SetBackgroundColor( Color::WHITE ); + + this->ctlRoot=Control::New(); + this->ctlRoot.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlRoot.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlRoot.SetSize(stageSize); + this->ctlRoot.SetPosition(0.0f, 0.0f); + this->ctlRoot.SetBackgroundColor(Color::WHITE); + stage.Add(this->ctlRoot); + + this->headerSize=Vector2(stageSize.width, stageSize.height*0.0781); + this->footerSize=Vector2(stageSize.width, stageSize.height*0.125); + this->bodySize=Vector2(stageSize.width, stageSize.height - (this->headerSize.y+footerSize.y)); + + this->lbtTitle=TextLabel::New(title); + this->lbtTitle.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->lbtTitle.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->lbtTitle.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER"); + this->lbtTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER"); + + this->ctlHeader=Control::New(); + this->ctlHeader.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlHeader.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlHeader.SetSize(this->headerSize); + this->ctlHeader.SetPosition(0.0f, 0.0f); + this->ctlHeader.SetBackgroundColor(CUSTOM_BLUE_COLOR); + this->ctlHeader.Add(this->lbtTitle); + this->ctlRoot.Add(this->ctlHeader); + + this->ctlBody=Control::New(); + this->ctlBody.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlBody.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlBody.SetSize(this->bodySize); + this->ctlBody.SetPosition(0.0f,this->headerSize.y); + //this->ctlBody.SetBackgroundColor(CUSTOM_BLUE_COLOR); + this->ctlRoot.Add(this->ctlBody); + //DBG("X=%d Y=%d",bodySize.x,bodySize.y); + + this->ctlFooter=Control::New(); + this->ctlFooter.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlFooter.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlFooter.SetSize(this->footerSize); + this->ctlFooter.SetPosition(0.0f,this->headerSize.y+this->bodySize.y); + this->ctlFooter.SetBackgroundColor(CUSTOM_BLUE_COLOR); + this->ctlRoot.Add(this->ctlFooter); + + this->ctlInfo=Control::New(); + this->ctlInfo.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlInfo.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlInfo.SetSize(this->bodySize+this->footerSize); + this->ctlInfo.SetPosition(0.0f,this->headerSize.y); + this->ctlInfo.SetBackgroundColor(Color::WHITE); + + this->tblVerdict=TableView::New(1,3); + this->tblVerdict.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->tblVerdict.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->tblVerdict.SetSize(this->footerSize); + this->tblVerdict.SetPosition(0.0f, 0.0f); + this->ctlFooter.Add(this->tblVerdict); + + Vector2 size(this->footerSize.x/3,this->footerSize.y); + this->btnPassButton = this->CreateVerdictButton(this->tblVerdict, TableView::CellPosition(0, 0), AnchorPoint::TOP_LEFT, Vector2(0.0f, 0.0f), "Pass", this, &UiUtils::OnPassButtonClick, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); + this->btnFailButton = this->CreateVerdictButton(this->tblVerdict, TableView::CellPosition(0, 1), AnchorPoint::TOP_LEFT, Vector2(0.0f, 0.0f), "Fail", this, &UiUtils::OnFailButtonClick, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); + this->btnInfoButton = this->CreateVerdictButton(this->tblVerdict, TableView::CellPosition(0, 2), AnchorPoint::TOP_LEFT, Vector2(0.0f, 0.0f), "Info", this, &UiUtils::OnInfoButtonClick, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); + + Stage::GetCurrent().KeyEventSignal().Connect( this, &UiUtils::OnKeyEvent ); +} + +template +PushButton UiUtils::CreateVerdictButton(TableView parent, TableView::CellPosition cellPosition, + Vector3 anchorPoint, Vector2 position, std::string label, X* obj, + Ret (X::*onClickedCallback)(Arg0 arg0), + Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) +{ + PushButton button = PushButton::New(); + button.SetAnchorPoint(anchorPoint); + button.SetPosition(position.x,position.y); + button.SetSize(size); + button.SetLabelText(label); + button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); + button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); + parent.AddChild(button, cellPosition); + + button.ClickedSignal().Connect(obj, onClickedCallback); + return button; +} + +//template +PushButton UiUtils::CreateButton(Vector3 anchorPoint, Vector2 position, std::string label,/* X* obj, + Ret (X::*onClickedCallback)(Arg0 arg0), */Vector4 selectedColor, + Vector4 unselectedColor, Vector2 size) +{ + PushButton button = PushButton::New(); + button.SetAnchorPoint(anchorPoint); + //button.SetParentOrigin(parentOrigin); + button.SetPosition(position.x,position.y); + button.SetSize(size); + button.SetLabelText(label); + button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); + button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); + + //button.ClickedSignal().Connect(obj, onClickedCallback); + return button; +} +TextLabel UiUtils::CreateTextLabel(Vector3 anchorPoint,Vector3 parentOrigin, Vector2 position, std::string txt, Vector2 size ) +{ + DBG("UiUtils::CreateTextLabel Begin"); + TextLabel label=TextLabel::New(" "+txt); + label.SetAnchorPoint(anchorPoint); + label.SetParentOrigin(parentOrigin); + label.SetPosition(position.x,position.y); + DBG("X=%f Y=%f Width=%f Height=%f",size.x,size.y,size.width,size.height); + label.SetSize(size); + label.SetProperty(TextLabel::Property::MULTI_LINE,true); + DBG("UiUtils::CreateTextLabel End"); + return label; +} +//template +Control UiUtils::CreateTextField(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size/*, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0)*/ ) +{ + Control customTextField = Control::New(); + customTextField.SetAnchorPoint( anchorPoint ); + customTextField.SetParentOrigin(parentOrigin); + customTextField.SetSize( size); + customTextField.SetPosition( position.x,position.y ); + Image customTextFieldBgImage = ResourceImage::New( this->mImageDirectory+"customTextFieldBgImage.jpg" ); + customTextField.SetBackgroundImage(customTextFieldBgImage); + + TextField field=TextField::New(); + field.SetAnchorPoint(anchorPoint); + field.SetParentOrigin(parentOrigin); + //field.SetPosition(position.x,position.y); + field.SetSize(size); + field.SetProperty( TextField::Property::POINT_SIZE, 10.0f ); + field.SetProperty( TextField::Property::TEXT_COLOR, CUSTOM_BLUE_COLOR); + field.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, "CENTER" ); + field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN" ); + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT,"Edit here"); + //field.SetBackgroundColor(Color::YELLOW); + customTextField.Add(field); + + PushButton btnCross = PushButton::New(); + btnCross.SetAnchorPoint( anchorPoint ); + btnCross.SetParentOrigin(parentOrigin); + btnCross.SetSize( size.width/10, size.height ); + btnCross.SetPosition( size.width - size.width/10, 0.0f ); + btnCross.SetUnselectedImage( this->mImageDirectory + "innerButtonUnselected.png" ); + btnCross.SetSelectedImage( this->mImageDirectory + "innerButtonSelected.png" ); + //btnCross.ClickedSignal().Connect( obj, onClickedCallback ); + customTextField.Add(btnCross); + + return customTextField; +} +//template +Control UiUtils::CreateTextEditor(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size/*, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0)*/ ) +{ + Control customTextEditor = Control::New(); + customTextEditor.SetAnchorPoint( anchorPoint ); + customTextEditor.SetParentOrigin(parentOrigin); + customTextEditor.SetSize( size); + customTextEditor.SetPosition( position.x,position.y ); + + TextEditor editor=TextEditor::New(); + editor.SetAnchorPoint(anchorPoint); + editor.SetParentOrigin(parentOrigin); + //editor.SetPosition(position.x,position.y); + editor.SetSize(size); + editor.SetBackgroundColor(CUSTOM_BLUE_COLOR); + editor.SetProperty( TextEditor::Property::POINT_SIZE, 10); + editor.SetProperty( TextEditor::Property::TEXT_COLOR, Color::BLACK); + editor.SetProperty( TextEditor::Property::TEXT, "Text edit here"); + editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "BEGIN" ); + customTextEditor.Add(editor); + + PushButton btnCross = PushButton::New(); + btnCross.SetAnchorPoint( anchorPoint ); + btnCross.SetParentOrigin(parentOrigin); + btnCross.SetSize( bodySize.width*TEXTEDITOR_HEIGHT, bodySize.height*TEXTEDITOR_HEIGHT ); + btnCross.SetPosition( size.width - size.width/10, 0.0f ); + btnCross.SetUnselectedImage( this->mImageDirectory + "innerButtonSelected.png" ); + btnCross.SetSelectedImage( this->mImageDirectory + "innerButtonUnselected.png" ); + //btnCross.ClickedSignal().Connect( obj, onClickedCallback ); + customTextEditor.Add(btnCross); + + return customTextEditor; +} +void UiUtils::CreateLabelList(Property::Map keyMap, Property::Map sizeMap) +{ + DBG("UiUtils::CreateLabelList Begin"); + //Dali::Property::Map textlabelMap; + std::string key; + Property::Value value; + Property::Value size_value; + Vector2 size; + Vector2 position; + int count=keyMap.Count(); + float next=Stage::GetCurrent().GetSize().height*0.039; + TextLabel lbl; + for(int i=0;i(); + position=Vector2(0.0f, next); + lbl=this->CreateTextLabel(AnchorPoint::TOP_LEFT, ParentOrigin::TOP_LEFT,position,value.Get(),size); + lbl.SetProperty( TextLabel::Property::POINT_SIZE, 8); + lbl.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED); + lbl.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "TOP"); + lbl.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "BEGIN"); + lbl.SetName(value.Get()); + //textlabelMap.Insert(key,lbl); + this->ctlBody.Add(lbl); + next=next+size.y; + } + DBG("UiUtils::CreateLabelList End"); + //return textlabelMap; +} + +bool UiUtils::OnPassButtonClick(Button button) +{ + DBG("UiUtils::OnPassButtonClick"); + app_control_h reply; + int nStatus = app_control_create(&reply); + + app_control_result_e res = APP_CONTROL_RESULT_SUCCEEDED; + nStatus = app_control_reply_to_launch_request(reply, _control, res); + DBG("app_control_reply_to_launch_request=%s", nStatus); + + this->mApplication.Quit(); + return true; +} +bool UiUtils::OnFailButtonClick(Button button) +{ + DBG("UiUtils::OnFailButtonClick"); + app_control_h reply; + int nStatus = app_control_create(&reply); + + app_control_result_e res = APP_CONTROL_RESULT_FAILED; + nStatus = app_control_reply_to_launch_request(reply, _control, res); + DBG("app_control_reply_to_launch_request=%s", nStatus); + this->mApplication.Quit(); + return true; +} +bool UiUtils::OnInfoButtonClick(Button button) +{ + DBG("UiUtils::OnInfoButtonClick"); + + DBG("ho ho i m in info page"); + this->bflag=true; + //Stage::GetCurrent().Remove(ctlRoot); + //ctlRoot.Add(ctlHeader); + ctlRoot.Remove(ctlBody); + ctlRoot.Add(ctlInfo); + + FillInfoPage(mInfoText); + return true; +} +void UiUtils::OnKeyEvent( const KeyEvent& event ) +{ + DBG("UiUtils::OnKeyEvent"); + + if( event.state == KeyEvent::Down ) + { + if( IsKey( event, DALI_KEY_ESCAPE ) || IsKey( event, DALI_KEY_BACK ) ) + { + //mApplication.Quit(); + if(this->bflag != true) + mApplication.Quit(); + DBG("ho ho i m in content page"); + ctlRoot.Remove(ctlInfo); + ctlRoot.Add(ctlBody); + this->bflag=false; + } + } +} +void UiUtils::FillInfoPage(std::string content) +{ + DBG("UiUtils::FillInfoPage"); + TextLabel lblText=TextLabel::New(); + lblText.SetProperty(TextLabel::Property::ENABLE_MARKUP, true); + lblText.SetProperty( TextLabel::Property::TEXT, content); + lblText.SetAnchorPoint(AnchorPoint::TOP_LEFT); + lblText.SetParentOrigin(ParentOrigin::TOP_LEFT); + lblText.SetSize(bodySize); + lblText.SetProperty(TextLabel::Property::POINT_SIZE,10.0f); + lblText.SetProperty(TextLabel::Property::TEXT_COLOR,Color::CYAN); + lblText.SetPosition(0.0f, 0.0f); + + this->ctlInfo.Add(lblText); } diff --git a/tbtcoreapp-dali/src/view/tbt-dali-accessibilty-manager-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-accessibilty-manager-view.cpp index 12fd391..40b8851 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-accessibilty-manager-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-accessibilty-manager-view.cpp @@ -1,115 +1,59 @@ #include "view/tbt-dali-accessibility-manager-view.h" TBTDaliAccessibilityManagerView::TBTDaliAccessibilityManagerView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { + UiUtils(mApplication, _control) { - CommonView::Initialize(); + Init("Accessibility Manager"); + mInfoText="Testing Accessibility Manager Functionality"; - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); mAccessibilityManager = AccessibilityManager::Get(); + Property::Map ctl; + Property::Map size; - mrootTable= TableView::New(9, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - //mrootTable.SetKeyboardFocusable(true); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); + ctl["lbl1"]=" Action activate signal not call"; + + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + CreateLabelList(ctl,size); - mStage.Add(mrootTable); -// -// Dali::Toolkit::PushButton button = Dali::Toolkit::PushButton::New(); -// button.SetSize(480, 800); -// Stage::GetCurrent().Add(button); -// mAccessibilityManager.SetFocusOrder( button, 1 ); -// mAccessibilityManager.SetCurrentFocusActor( button ); mAccessibilityManager.ActionActivateSignal().Connect(this,&TBTDaliAccessibilityManagerView::OnAccessibilityActionSignalType); mAccessibilityManager.ActionNextSignal().Connect(this, &TBTDaliAccessibilityManagerView::OnActionNextSignal); - Vector2 size(512,512); - - lblActionActivate=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblActionActivate.SetProperty(TextLabel::Property::TEXT,"Action activate signal not call"); - lblActionActivate.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblActionActivate.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblActionActivate.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblPreFocus.SetKeyboardFocusable(true); - - - btn1=PushButton::New(); - btn1.SetLabelText("Up"); - btn1.SetName("btnUp"); - btn1.SetSize(mStageSize.width,100); - btn1.ClickedSignal().Connect(this,&TBTDaliAccessibilityManagerView::OnClick); - mrootTable.AddChild( btn1, TableView::CellPosition( 7, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 7, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); - mAccessibilityManager.SetFocusOrder( btn1, 1 ); - mAccessibilityManager.SetCurrentFocusActor( btn1 ); - - btn2=PushButton::New(); - btn2.SetLabelText("Down"); - btn2.SetName("btnDown"); - btn2.SetSize(mStageSize.width,100); - //btn2.ClickedSignal().Connect(this,&TBTDaliAccessibilityManagerView::OnClick); - mrootTable.AddChild( btn2, TableView::CellPosition( 8, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 8, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); - mAccessibilityManager.SetFocusOrder( btn2, 2 ); - //mAccessibilityManager.SetCurrentFocusActor( btnActionActivate ); - -} - -template -PushButton TBTDaliAccessibilityManagerView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliAccessibilityManagerView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; + Vector2 buttonSize=Vector2(bodySize.width, BUTTON_HEIGHT*bodySize.height); + + Vector2 posDown=Vector2(0.0f, bodySize.height - (buttonSize.height + VERTICAL_SPACE*bodySize.height)); + btnDown=CreateButton(AnchorPoint::TOP_LEFT, posDown, "Down", selectedColor, unSelectedColor, buttonSize); + btnDown.ClickedSignal().Connect(this,&TBTDaliAccessibilityManagerView::OnClick); + mAccessibilityManager.SetFocusOrder( btnDown, 1 ); + mAccessibilityManager.SetCurrentFocusActor( btnDown ); + ctlBody.Add(btnDown); + + Vector2 posUp=Vector2(0.0f, bodySize.height - (BUTTON_HEIGHT*bodySize.height + VERTICAL_SPACE*bodySize.height + buttonSize.height + VERTICAL_SPACE*bodySize.height)); + btnUp=CreateButton(AnchorPoint::TOP_LEFT, posUp, "Up", selectedColor, unSelectedColor, buttonSize); + btnUp.ClickedSignal().Connect(this,&TBTDaliAccessibilityManagerView::OnClick); + mAccessibilityManager.SetFocusOrder( btnUp, 2 ); + mAccessibilityManager.SetCurrentFocusActor( btnUp ); + ctlBody.Add(btnUp); + mAccessibilityManager.SetCurrentFocusActor( btnUp ); } bool TBTDaliAccessibilityManagerView::OnClick(Button button) { DBG("In TBTDaliAccessibilityManagerView::OnClick"); mAccessibilityManager.MoveFocusForward(); - mAccessibilityManager.SetCurrentFocusActor(btn2); - Actor actor=mAccessibilityManager.GetCurrentFocusActor(); - std::string str=actor.GetName(); - -// lblActionActivate.SetProperty(TextLabel::Property::TEXT,str); -// lblActionActivate.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + mAccessibilityManager.SetCurrentFocusActor(btnDown); return true; } bool TBTDaliAccessibilityManagerView::OnAccessibilityActionSignalType( AccessibilityManager& manager ) { DBG("In TBTDaliAccessibilityManagerView::OnAccessibilityActionSignalType"); - lblActionActivate.SetProperty(TextLabel::Property::TEXT,"Action activate signal called"); - lblActionActivate.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + Actor actor0=ctlBody.GetChildAt(0); + TextLabel lbl=TextLabel::DownCast(actor0); + lbl.SetProperty(TextLabel::Property::TEXT,"Action activate signal called"); + lbl.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); return true; } bool TBTDaliAccessibilityManagerView::OnActionNextSignal(AccessibilityManager& manager) diff --git a/tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp index 0fb1123..01b1faa 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-actor-view.cpp @@ -82,82 +82,45 @@ std::string GetPointState ( PointState::Type state ) TBTDaliActorView::TBTDaliActorView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) + UiUtils(mApplication, _control) { DBG("In TBTDaliActorView"); - CommonView::Initialize(); - float height= Stage::GetCurrent().GetSize().height; - float width=Stage::GetCurrent().GetSize().width; - - TableView rootTable = TableView::New(7, 1); - rootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - rootTable.SetParentOrigin(ParentOrigin::TOP_LEFT); - rootTable.SetSize(width, height - GetVerdictTableHeight()-100); - rootTable.SetPosition(0.0f,0.0f); - Stage::GetCurrent().Add(rootTable); - - Vector2 size(width, GetVerdictTableHeight()); - - txtTouched=CreateTextLabel(rootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Touched signal not call",size); - txtTouchEventData=CreateTextLabel(rootTable,TableView::CellPosition(2,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Touched event data",size); - //txtTouch=CreateTextLabel(rootTable,TableView::CellPosition(3,0),AnchorPoint::CENTER_LEFT,AnchorPoint::BOTTOM_LEFT,"Touch signal not call",size); - //txtTouchData=CreateTextLabel(rootTable,TableView::CellPosition(4,0),AnchorPoint::CENTER_LEFT,AnchorPoint::BOTTOM_LEFT,"Touch data",size); - txtHovered=CreateTextLabel(rootTable,TableView::CellPosition(3,0),AnchorPoint::CENTER_LEFT,AnchorPoint::BOTTOM_LEFT,"Hover signal not call",size); - txtHoveredData=CreateTextLabel(rootTable,TableView::CellPosition(4,0),AnchorPoint::TOP_LEFT,AnchorPoint::TOP_LEFT,"Hover signal data",size); - txtWheel=CreateTextLabel(rootTable,TableView::CellPosition(5,0),AnchorPoint::CENTER_LEFT,AnchorPoint::BOTTOM_LEFT,"Wheel signal not call",size); - - rootTable.SetCellAlignment(TableView::CellPosition(1,0),HorizontalAlignment::LEFT,VerticalAlignment::CENTER); - rootTable.SetCellAlignment(TableView::CellPosition(3,0),HorizontalAlignment::LEFT,VerticalAlignment::CENTER); - rootTable.SetCellAlignment(TableView::CellPosition(5,0),HorizontalAlignment::LEFT,VerticalAlignment::CENTER); - - rootTable.SetCellAlignment(TableView::CellPosition(2,0),HorizontalAlignment::LEFT,VerticalAlignment::TOP); - rootTable.SetCellAlignment(TableView::CellPosition(4,0),HorizontalAlignment::LEFT,VerticalAlignment::TOP); - - btnButton=CreateButton(rootTable, TableView::CellPosition(6, 0), - AnchorPoint::BOTTOM_LEFT, AnchorPoint::BOTTOM_LEFT, "Test Button", - this, &TBTDaliActorView::cbButtonClicked, - Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); + Init("Actor"); + mInfoText="Testing Dali Actor Functionality"; + Vector2 stageSize= Stage::GetCurrent().GetSize(); + + Property::Map ctl; + ctl["lbl1"]="Touched signal not call"; + ctl["lbl2"]="Touched event data"; + ctl["lbl3"]="Hover signal not call"; + ctl["lbl4"]="Hover data"; + ctl["lbl5"]="Wheel signal not call"; + + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, 2*TEXTLABEL_HEIGHT * bodySize.height); + size["lbl3"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl4"]=Vector2(bodySize.width, 2*TEXTLABEL_HEIGHT * bodySize.height); + size["lbl5"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + + CreateLabelList(ctl,size);//create textlabel list + txtTouched=TextLabel::DownCast(ctlBody.GetChildAt(0)); + txtTouchEventData=TextLabel::DownCast(ctlBody.GetChildAt(1)); + txtHovered=TextLabel::DownCast(ctlBody.GetChildAt(2)); + txtHoveredData=TextLabel::DownCast(ctlBody.GetChildAt(3)); + txtWheel=TextLabel::DownCast(ctlBody.GetChildAt(4)); + + Vector2 buttonSize=Vector2(bodySize.width, BUTTON_HEIGHT*bodySize.height); + Vector2 position=Vector2(0.0f, bodySize.height - (buttonSize.height + VERTICAL_SPACE*bodySize.height)); + btnButton=CreateButton(AnchorPoint::TOP_LEFT, position, "Test Actor(Touch/Hover/Wheel) Signal", selectedColor, unSelectedColor, buttonSize); + ctlBody.Add(btnButton); btnButton.TouchedSignal().Connect(this, &TBTDaliActorView::cbTouchedSignal); - //btnButton.TouchSignal().Connect(this, &TBTDaliActorView::cbTouchSignal); btnButton.HoveredSignal().Connect(this, &TBTDaliActorView::cbHoveredSignal); btnButton.WheelEventSignal().Connect(this, &TBTDaliActorView::cbWheelEventSignal); btnButton.ClickedSignal().Connect(this, &TBTDaliActorView::cbButtonClicked); } -template -PushButton TBTDaliActorView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliActorView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - txtLabel.SetSize(size); - txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetParentOrigin(ParentOrigin::TOP_LEFT); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; -} - bool TBTDaliActorView::cbTouchedSignal(Actor actor, const TouchEvent& event) { DBG("In cbTouchedSignal"); @@ -223,44 +186,6 @@ bool TBTDaliActorView::cbTouchedSignal(Actor actor, const TouchEvent& event) return true; } -bool TBTDaliActorView::cbTouchSignal(Actor actor, const TouchData& data) -{ - DBG("In cbTouchSignal"); - - this->txtTouch.SetProperty( TextLabel::Property::TEXT, "Touch Signal is Called" ); - this->txtTouch.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); - - std::string txt=""; - //time - unsigned long time=data.GetTime()/1000; - txt.append("Touch time: "); - int hr=(time/3600)%24; - int sec=time%3600; - int min=sec/60; - sec=sec%60; - txt.append(LongToString(hr)+":"+LongToString(min)+":"+LongToString(sec)); - - //point count - int count=data.GetPointCount(); - txt.append(", Point count: "); - txt.append(IntToString(count)); - - // - int id=data.GetDeviceId(data.GetPointCount()); - txt.append(", DeviceId: "); - txt.append(IntToString(id)); - - //state - txt.append(", State: "); - txt.append(GetPointState(data.GetState(data.GetPointCount()))); - - - this->txtTouchData.SetProperty( TextLabel::Property::TEXT, txt ); - this->txtTouchData.SetProperty( TextLabel::Property::POINT_SIZE, 7.0f ); - this->txtTouchData.SetProperty(TextLabel::Property::TEXT_COLOR,Color::CYAN); - - return true; -} bool TBTDaliActorView::cbHoveredSignal(Actor actor, const HoverEvent& event) { diff --git a/tbtcoreapp-dali/src/view/tbt-dali-app-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-app-view.cpp new file mode 100644 index 0000000..4a01568 --- /dev/null +++ b/tbtcoreapp-dali/src/view/tbt-dali-app-view.cpp @@ -0,0 +1,175 @@ +#include "view/tbt-dali-app-view.h" + +TBTDaliAppView::TBTDaliAppView(Application& mApplication, app_control_h _control) : + UiUtils(mApplication, _control) { + + Init("Application Signal"); + mInfoText="Dali Application Functionality"; + + Stage stage = Stage::GetCurrent(); + + Property::Map ctl; + Property::Map size; + + ctl["lbl1"]=" Terminate signal not call"; + ctl["lbl2"]=" Pause signal not call"; + ctl["lbl3"]=" Idle signal not call"; + ctl["lbl4"]=" AppControl signal not call"; + ctl["lbl5"]=" Battery low signal not call"; + ctl["lbl6"]=" Language changed signal not call"; + ctl["lbl7"]=" Memory low signal not call"; + ctl["lbl8"]=" Region changed signal not call"; + //ctl["lbl9"]=" Reset signal not call"; + ctl["lbl10"]=" Resume signal not call"; + //ctl["lbl11"]=" Resize signal not call"; + + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl3"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl4"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl5"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl6"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl7"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl8"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + //size["lbl9"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl10"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + //size["lbl11"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + + CreateLabelList(ctl,size);//create textlabel list + + lblTerminateSignal=TextLabel::DownCast(ctlBody.GetChildAt(0)); + lblPauseSignal=TextLabel::DownCast(ctlBody.GetChildAt(1)); + lblIdleSignal=TextLabel::DownCast(ctlBody.GetChildAt(2)); + lblAppControlSignal=TextLabel::DownCast(ctlBody.GetChildAt(3)); + lblBatteryLowSignal=TextLabel::DownCast(ctlBody.GetChildAt(4)); + lblLanguageChangedSignal=TextLabel::DownCast(ctlBody.GetChildAt(5)); + lblMemoryLowSignal=TextLabel::DownCast(ctlBody.GetChildAt(6)); + lblRegionChangedSignal=TextLabel::DownCast(ctlBody.GetChildAt(7)); + //lblResetSignal=TextLabel::DownCast(ctlBody.GetChildAt(8)); + lblResumeSignal=TextLabel::DownCast(ctlBody.GetChildAt(8)); + //lblResizeSignal=TextLabel::DownCast(ctlBody.GetChildAt(10)); + + mApplication.TerminateSignal().Connect( this, &TBTDaliAppView::OnTerminate); + mApplication.PauseSignal().Connect( this, &TBTDaliAppView::OnPause ); + mApplication.AddIdle( MakeCallback( this, &TBTDaliAppView::OnIdle ) ); + mApplication.BatteryLowSignal().Connect( this, &TBTDaliAppView::OnApplicationBatteryLowSignalCallback ); + mApplication.LanguageChangedSignal().Connect(this, &TBTDaliAppView::OnApplicationLanguageChangedSignalCallback ); + mApplication.MemoryLowSignal().Connect(this, &TBTDaliAppView::OnApplicationMemoryLowSignalCallback); + mApplication.RegionChangedSignal().Connect(this, &TBTDaliAppView::OnApplicationRegionChangedSignalCallback); + //mApplication.ResetSignal().Connect(this, &TBTDaliAppView::OnApplicationResetSignalCallback); + mApplication.ResumeSignal().Connect(this, &TBTDaliAppView::OnApplicationResumeSignalCallback); + //mApplication.ResizeSignal().Connect(this, &TBTDaliAppView::OnApplicationResizeSignalCallback); + + stage.ContextLostSignal().Connect(this,&TBTDaliAppView::onContextLost); + stage.ContextRegainedSignal().Connect(this,&TBTDaliAppView::onContextRegain); + + lblAppControlSignal.SetProperty(TextLabel::Property::TEXT," App control signal called"); + lblAppControlSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblAppControlSignal.SetProperty(TextLabel::Property::POINT_SIZE,8); +} +void TBTDaliAppView::onContextLost() +{ + DBG("In DaliTestController::onContextLost"); +// txtContext.SetProperty(TextLabel::Property::TEXT,"Context lost event is called"); +// txtContext.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); +} +void TBTDaliAppView::onContextRegain() +{ + DBG("In DaliTestController::onContextRegain"); +// txtContextRegain.SetProperty(TextLabel::Property::TEXT,"Context regain event is called"); +// txtContextRegain.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); +} +bool TBTDaliAppView::lowerButtonClicked(Button) +{ + DBG("DaliTestController::lowerButtonClicked"); + mApplication.Lower(); + return true; +} + +bool TBTDaliAppView::resetButtonClicked(Button) +{ + DBG("DaliTestController::resetButtonClicked"); + mApplication.Reset(); + return true; +} + +bool TBTDaliAppView::resizeButtonClicked(Button) +{ + DBG("DaliTestController::resizeButtonClicked"); + Window window = mApplication.GetWindow(); + //window.RotateIndicator(Window::LANDSCAPE); + mApplication.ReplaceWindow(PositionSize( 0, 0, Stage::GetCurrent().GetSize().width - 1, Stage::GetCurrent().GetSize().height - 1) ,"Window"); + //window=Window::New(PositionSize( 0, 0, Stage::GetCurrent().GetSize().width - 1, Stage::GetCurrent().GetSize().height - 1), "New Window", true); + return true; +} +void TBTDaliAppView::OnTerminate(Application& app) +{ + DBG("DaliTestController::OnTerminate"); + lblTerminateSignal.SetProperty(TextLabel::Property::TEXT," Terminate signal called"); + lblTerminateSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblTerminateSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} +void TBTDaliAppView::OnPause(Application& app) +{ + DBG("DaliTestController::OnPause"); + lblPauseSignal.SetProperty(TextLabel::Property::TEXT," Pause signal called"); + lblPauseSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblPauseSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} + +void TBTDaliAppView::OnIdle() +{ + DBG("DaliTestController::OnIdle"); + lblIdleSignal.SetProperty(TextLabel::Property::TEXT," Idle signal called"); + lblIdleSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblIdleSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} +void TBTDaliAppView::OnApplicationBatteryLowSignalCallback(Application& app) +{ + DBG("DaliTestController::OnApplicationBatteryLowSignalCallback"); + lblBatteryLowSignal.SetProperty(TextLabel::Property::TEXT," Battery signal called"); + lblBatteryLowSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblBatteryLowSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} +void TBTDaliAppView::OnApplicationLanguageChangedSignalCallback(Application&) +{ + DBG("DaliTestController::OnApplicationLanguageChangedSignalCallback"); + lblLanguageChangedSignal.SetProperty(TextLabel::Property::TEXT," Language changed signal called"); + lblLanguageChangedSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblLanguageChangedSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} +void TBTDaliAppView::OnApplicationMemoryLowSignalCallback(Application& app) +{ + DBG("DaliTestController::OnApplicationMemoryLowSignalCallback"); + lblMemoryLowSignal.SetProperty(TextLabel::Property::TEXT," Memory low signal called"); + lblMemoryLowSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblMemoryLowSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} +void TBTDaliAppView::OnApplicationRegionChangedSignalCallback(Application& app) +{ + DBG("DaliTestController::OnApplicationRegionChangedSignalCallback"); + lblRegionChangedSignal.SetProperty(TextLabel::Property::TEXT," Region chanhed signal called"); + lblRegionChangedSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblRegionChangedSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} +void TBTDaliAppView::OnApplicationResetSignalCallback(Application& app) +{ + DBG("DaliTestController::OnApplicationResetSignalCallback"); + lblResetSignal.SetProperty(TextLabel::Property::TEXT," Reset signal called"); + lblResetSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblResetSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} +void TBTDaliAppView::OnApplicationResumeSignalCallback(Application& app) +{ + DBG("DaliTestController::OnApplicationResumeSignalCallback"); + lblResumeSignal.SetProperty(TextLabel::Property::TEXT," Resume signal called"); + lblResumeSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblResumeSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} +void TBTDaliAppView::OnApplicationResizeSignalCallback(Application& app) +{ + DBG("DaliTestController::OnApplicationResizeSignalCallback"); + lblResizeSignal.SetProperty(TextLabel::Property::TEXT," Resize signal called"); + lblResizeSignal.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblResizeSignal.SetProperty(TextLabel::Property::POINT_SIZE, 8); +} diff --git a/tbtcoreapp-dali/src/view/tbt-dali-button-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-button-view.cpp index c24904d..f7f781f 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-button-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-button-view.cpp @@ -1,84 +1,39 @@ #include "view/tbt-dali-button-view.h" TBTDaliButtonView::TBTDaliButtonView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { + UiUtils(mApplication, _control) { - CommonView::Initialize(); + Init("Button");//initialize the common view + mInfoText="Testing Dali Button Actor Functionality"; - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); - mrootTable= TableView::New(7, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); - mStage.Add(mrootTable); + Property::Map ctl; + ctl["lbl1"]="Button click event not call"; + ctl["lbl2"]="Button press event not call"; + ctl["lbl3"]="Button release event not call"; - Vector2 size(512,512); + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl3"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); - txtClick=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Button click signal not call",size); - txtClick.SetProperty(TextLabel::Property::TEXT,"Button click event not call"); - txtClick.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - txtClick.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - txtClick.SetAnchorPoint(AnchorPoint::TOP_LEFT); + CreateLabelList(ctl,size);//create textlabel list + txtClick=TextLabel::DownCast(ctlBody.GetChildAt(0)); + txtPress=TextLabel::DownCast(ctlBody.GetChildAt(1)); + txtRelease=TextLabel::DownCast(ctlBody.GetChildAt(2)); - txtPress=CreateTextLabel(mrootTable,TableView::CellPosition(2,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Button press signal not call",size); - txtPress.SetProperty(TextLabel::Property::TEXT,"Button press event not call"); - txtPress.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - txtPress.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - txtPress.SetAnchorPoint(AnchorPoint::TOP_LEFT); - - txtRelease=CreateTextLabel(mrootTable,TableView::CellPosition(3,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Button release signal not call",size); - txtRelease.SetProperty(TextLabel::Property::TEXT,"Button release event not call"); - txtRelease.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - txtRelease.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - txtRelease.SetAnchorPoint(AnchorPoint::TOP_LEFT); - - btnTest=CreateButton(mrootTable, TableView::CellPosition(5, 0), - AnchorPoint::BOTTOM_LEFT, AnchorPoint::BOTTOM_LEFT, "Test Button", - this, &TBTDaliButtonView::onClicked, - Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),Vector2(mStageSize.width,GetVerdictTableHeight())); + Vector2 buttonSize=Vector2(bodySize.width, BUTTON_HEIGHT*bodySize.height); + Vector2 position=Vector2(0.0f, bodySize.height - (buttonSize.height + VERTICAL_SPACE*bodySize.height)); + btnTest=CreateButton(AnchorPoint::TOP_LEFT, position, "Test Button(Click/Press/Release) Signal", selectedColor, unSelectedColor, buttonSize); + ctlBody.Add(btnTest); btnTest.ClickedSignal().Connect(this,&TBTDaliButtonView::onClicked); btnTest.PressedSignal().Connect(this,&TBTDaliButtonView::onPressed); btnTest.ReleasedSignal().Connect(this,&TBTDaliButtonView::onReleased); - - mStage.Add( mrootTable ); } -template -PushButton TBTDaliButtonView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliButtonView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; -} bool TBTDaliButtonView::onClicked(Button button) { DBG("In TBTDaliButtonView::onClicked"); diff --git a/tbtcoreapp-dali/src/view/tbt-dali-common-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-common-view.cpp deleted file mode 100644 index d9e218e..0000000 --- a/tbtcoreapp-dali/src/view/tbt-dali-common-view.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include "view/tbt-dali-common-view.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -CommonView::CommonView(Application& mApplication, app_control_h _control) { - - DBG("In CommonView"); - this->mApplication = mApplication; - this->_control = _control; - this->verdictTableHeight = 0; -} - -void CommonView::Initialize() { - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); - mStage.SetBackgroundColor(Color::WHITE); - verdictTableHeight = mStageSize.height / 8; - - TableView verdictTable = TableView::New(1, 3); - verdictTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - verdictTable.SetSize(mStageSize.width, verdictTableHeight); - verdictTable.SetPosition(0, mStageSize.height-verdictTableHeight); - mStage.Add(verdictTable); - - Vector2 size(mStageSize.width / 3, verdictTableHeight); - - passButton = CreateButton(verdictTable, TableView::CellPosition(0, 0), AnchorPoint::BOTTOM_LEFT, AnchorPoint::BOTTOM_LEFT, "Pass", this, &CommonView::OnPassButtonClicked, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); - failButton = CreateButton(verdictTable, TableView::CellPosition(0, 1), AnchorPoint::BOTTOM_LEFT, AnchorPoint::BOTTOM_LEFT, "Fail", this, &CommonView::OnFailButtonClicked, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); - infoButton = CreateButton(verdictTable, TableView::CellPosition(0, 2), AnchorPoint::BOTTOM_LEFT, AnchorPoint::BOTTOM_LEFT, "Info", this, &CommonView::OnInfoButtonClicked, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); - -} -float CommonView::GetVerdictTableHeight() { - return verdictTableHeight; -} - -template -PushButton CommonView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; - -} - - -TextField CommonView::CreateTextField(const Vector2& size, const std::string& text) { - TextField field = TextField::New(); - field.SetSize(size); - field.SetAnchorPoint(AnchorPoint::TOP_LEFT); - field.SetParentOrigin(ParentOrigin::TOP_LEFT); - field.SetProperty(TextField::Property::TEXT, text); - field.SetProperty(TextField::Property::TEXT_COLOR, Color::BLACK); - field.SetProperty(TextField::Property::PLACEHOLDER_TEXT, - "Edit text here"); - field.SetProperty(TextField::Property::VERTICAL_ALIGNMENT, "CENTER"); - field.SetProperty(TextField::Property::HORIZONTAL_ALIGNMENT, "CENTER"); - field.SetProperty(TextField::Property::POINT_SIZE, 10.0f); - Image image = ResourceImage::New( - get_resource_path("/images/text-field-bg.9.png")); - field.SetBackgroundImage(image); - - return field; -} -bool CommonView::OnPassButtonClicked(Button button) { - DBG("OnPassButtonClicked"); - - app_control_h reply; - int nStatus = app_control_create(&reply); - - app_control_result_e res = APP_CONTROL_RESULT_SUCCEEDED; - nStatus = app_control_reply_to_launch_request(reply, _control, res); - DBG("app_control_reply_to_launch_request=%s", nStatus); - - this->mApplication.Quit(); - return true; -} - -bool CommonView::OnFailButtonClicked(Button button) { - DBG("OnFailButtonClicked"); - - app_control_h reply; - int nStatus = app_control_create(&reply); - - app_control_result_e res = APP_CONTROL_RESULT_FAILED; - nStatus = app_control_reply_to_launch_request(reply, _control, res); - DBG("app_control_reply_to_launch_request=%s", nStatus); - this->mApplication.Quit(); - return true; -} - -bool CommonView::OnInfoButtonClicked(Button button) { - DBG("OnInfoButtonClicked"); - Evas_Object *popup = elm_popup_add(NULL); - RETVM_IF(NULL == popup, false, "popup is not created"); - elm_object_part_text_set(popup, "title,text", "amlan"); - evas_object_show(popup); - //eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _eext_popup_back_cb, NULL); - return true; -} - -bool CommonView::OnTouch(Actor actor, const TouchEvent& event) { - // Quit the application - //mApplication.Quit(); - return true; -} - -void CommonView::OnKeyEvent(const KeyEvent& event) { - if (event.state == KeyEvent::Down) { - if (IsKey(event, DALI_KEY_ESCAPE) || IsKey(event, DALI_KEY_BACK)) { - app_control_h reply; - int nStatus = app_control_create(&reply); - - app_control_result_e res = APP_CONTROL_RESULT_CANCELED; - nStatus = app_control_reply_to_launch_request(reply, _control, res); - DBG("app_control_reply_to_launch_request=%s", nStatus); - this->mApplication.Quit(); - } - } -} -float CommonView::GetScreenHeight() -{ - return Stage::GetCurrent().GetSize().height; -} - -float CommonView::GetScreenWidth() -{ - return Stage::GetCurrent().GetSize().width; -} diff --git a/tbtcoreapp-dali/src/view/tbt-dali-gesture-detector-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-gesture-detector-view.cpp index 707f556..05f0732 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-gesture-detector-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-gesture-detector-view.cpp @@ -1,106 +1,60 @@ #include "view/tbt-dali-gesture-detector-view.h" TBTDaliGestureDetectorView::TBTDaliGestureDetectorView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { + UiUtils(mApplication, _control) { - CommonView::Initialize(); + Init("Gesture Detector");//initialize the common view + mInfoText="Testing Gesture Detector Functionality"; - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); - mrootTable= TableView::New(9, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - //mrootTable.SetKeyboardFocusable(true); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); + Property::Map ctl; + ctl["lbl1"]="Long press gesture detector signal not call"; + ctl["lbl2"]="Pinch gesture detector signal not call"; + ctl["lbl3"]="Pan gesture detector signal not call"; - mStage.Add(mrootTable); - Vector2 size(512,512); + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl3"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); - lblLongPress=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblLongPress.SetProperty(TextLabel::Property::TEXT,"Long press gesture detector signal not call"); - lblLongPress.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblLongPress.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblLongPress.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblPreFocus.SetKeyboardFocusable(true); - - lblPinch=CreateTextLabel(mrootTable,TableView::CellPosition(2,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblPinch.SetProperty(TextLabel::Property::TEXT,"Pinch gesture detector signal not call"); - lblPinch.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblPinch.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblPinch.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblPreFocus.SetKeyboardFocusable(true); - - - lblpan=CreateTextLabel(mrootTable,TableView::CellPosition(3,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblpan.SetProperty(TextLabel::Property::TEXT,"Pan gesture detector signal not call"); - lblpan.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblpan.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblpan.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblPreFocus.SetKeyboardFocusable(true); + CreateLabelList(ctl,size);//create textlabel list + lblLongPress=TextLabel::DownCast(ctlBody.GetChildAt(0)); + lblPinch=TextLabel::DownCast(ctlBody.GetChildAt(1)); + lblpan=TextLabel::DownCast(ctlBody.GetChildAt(2)); longpressgesture=LongPressGestureDetector::New(); - longpressgesture.Attach(mrootTable); + longpressgesture.Attach(ctlBody); longpressgesture.DetectedSignal().Connect(this, &TBTDaliGestureDetectorView::OnLongPressGestureDetector); pinchgesture=PinchGestureDetector::New(); - pinchgesture.Attach(mrootTable); + pinchgesture.Attach(ctlBody); pinchgesture.DetectedSignal().Connect(this, &TBTDaliGestureDetectorView::OnPinchGestureDetector); panGesture=PanGestureDetector::New(); - panGesture.Attach(mrootTable); + panGesture.Attach(ctlBody); panGesture.DetectedSignal().Connect(this, &TBTDaliGestureDetectorView::OnPanGestureDetector); } - -template -PushButton TBTDaliGestureDetectorView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliGestureDetectorView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; -} void TBTDaliGestureDetectorView::OnLongPressGestureDetector(Actor actor, const LongPressGesture& gesture) { DBG("In TBTDaliGestureDetectorView::OnLongPressGestureDetector"); - lblLongPress.SetProperty(TextLabel::Property::TEXT,"Long press gesture detector signal called"); + lblLongPress.SetProperty(TextLabel::Property::TEXT," Long press gesture detector signal called"); lblLongPress.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblLongPress.SetProperty(TextLabel::Property::POINT_SIZE,9); } void TBTDaliGestureDetectorView::OnPinchGestureDetector(Actor actor, const PinchGesture& gesture) { DBG("In TBTDaliGestureDetectorView::OnPinchGestureDetector"); - lblPinch.SetProperty(TextLabel::Property::TEXT,"Pinch gesture detector signal called"); + lblPinch.SetProperty(TextLabel::Property::TEXT," Pinch gesture detector signal called"); lblPinch.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblPinch.SetProperty(TextLabel::Property::POINT_SIZE,9); } void TBTDaliGestureDetectorView::OnPanGestureDetector(Actor actor, const PanGesture& gesture) { DBG("In TBTDaliGestureDetectorView::OnPanGestureDetector"); - lblpan.SetProperty(TextLabel::Property::TEXT,"Pan gesture detector signal called"); + lblpan.SetProperty(TextLabel::Property::TEXT," Pan gesture detector signal called"); lblpan.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + lblpan.SetProperty(TextLabel::Property::POINT_SIZE,9); } diff --git a/tbtcoreapp-dali/src/view/tbt-dali-keyboard-focus-manager-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-keyboard-focus-manager-view.cpp index 14f026e..2056b41 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-keyboard-focus-manager-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-keyboard-focus-manager-view.cpp @@ -1,164 +1,144 @@ #include "view/tbt-dali-keyboard-focus-manager-view.h" TBTDaliKeyBoardFocusManagerView::TBTDaliKeyBoardFocusManagerView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { + UiUtils(mApplication, _control) { - CommonView::Initialize(); - - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Init("Key Board Focus Manager"); + mInfoText="Testing Keyboard Focus Manager Functionality"; + Stage stage = Stage::GetCurrent(); mFocusManager = KeyboardFocusManager::Get(); - mrootTable= TableView::New(10, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - mrootTable.SetKeyboardFocusable(true); - mFocusManager.SetAsFocusGroup(mrootTable,true); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); - mStage.Add(mrootTable); - - Vector2 size(512,512); - - lblPreFocus=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblPreFocus.SetProperty(TextLabel::Property::TEXT,"Prefocus signal not call"); - lblPreFocus.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblPreFocus.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblPreFocus.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblPreFocus.SetKeyboardFocusable(true); - - lblFocusChange=CreateTextLabel(mrootTable,TableView::CellPosition(2,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblFocusChange.SetProperty(TextLabel::Property::TEXT,"Focus change signal not call"); - lblFocusChange.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblFocusChange.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblFocusChange.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblFocusChange.SetKeyboardFocusable(true); - - lblFocusGroup=CreateTextLabel(mrootTable,TableView::CellPosition(3,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblFocusGroup.SetProperty(TextLabel::Property::TEXT,"Focus group signal not call"); - lblFocusGroup.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblFocusGroup.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblFocusGroup.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblFocusGroup.SetKeyboardFocusable(true); - - lblFocusActor=CreateTextLabel(mrootTable,TableView::CellPosition(4,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblFocusActor.SetProperty(TextLabel::Property::TEXT,"Focus actor signal not call"); - lblFocusActor.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblFocusActor.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblFocusActor.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblFocusActor.SetKeyboardFocusable(true); - - txt1=TextField::New(); - txt1.SetProperty(TextField::Property::TEXT,"Type here.."); - mrootTable.AddChild( txt1, TableView::CellPosition( 5, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 5, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); - //txt1.SetKeyInputFocus(); - txt1.SetKeyboardFocusable(true); - //mFocusManager.SetCurrentFocusActor(txt1); + Property::Map ctl; + Property::Map size; - txt2=TextEditor::New(); - txt2.SetProperty(TextField::Property::TEXT,"Type here.."); - mrootTable.AddChild( txt2, TableView::CellPosition( 6, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 6, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); - //txt2.SetKeyInputFocus(); - txt2.SetKeyboardFocusable(true); + ctl["lbl1"]="Prefocus signal not call"; + ctl["lbl2"]="Focus change signal not call"; + ctl["lbl3"]="Focus group signal not call"; + ctl["lbl4"]="Focused actor signal not call"; - btnUp=PushButton::New(); - btnUp.SetLabelText("Up"); - btnUp.SetName("btnUp"); - btnUp.SetSize(mStageSize.width,100); - btnUp.ClickedSignal().Connect(this,&TBTDaliKeyBoardFocusManagerView::OnUpClick); - mrootTable.AddChild( btnUp, TableView::CellPosition( 8, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 8, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl3"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl4"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + + CreateLabelList(ctl,size); + + DBG("Count >>>>>> %d",ctlBody.GetChildCount()); + + lblPreFocus=TextLabel::DownCast(ctlBody.GetChildAt(0)); + lblFocusChange=TextLabel::DownCast(ctlBody.GetChildAt(1)); + lblFocusGroup=TextLabel::DownCast(ctlBody.GetChildAt(2)); + lblFocusActor=TextLabel::DownCast(ctlBody.GetChildAt(3)); + + //button + Vector2 buttonSize=Vector2(bodySize.width, BUTTON_HEIGHT*bodySize.height); - btnDown=PushButton::New(); - btnDown.SetLabelText("Down"); - btnDown.SetName("btnUp"); - btnDown.SetSize(mStageSize.width,100); + Vector2 posDown=Vector2(0.0f, bodySize.height - (buttonSize.height + VERTICAL_SPACE*bodySize.height)); + btnDown=CreateButton(AnchorPoint::TOP_LEFT, posDown, "Down", selectedColor, unSelectedColor, buttonSize); btnDown.ClickedSignal().Connect(this,&TBTDaliKeyBoardFocusManagerView::OnDownClick); - mrootTable.AddChild( btnDown, TableView::CellPosition( 9, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 9, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + ctlBody.Add(btnDown); + + Vector2 posUp=Vector2(0.0f, bodySize.height - (BUTTON_HEIGHT*bodySize.height + VERTICAL_SPACE*bodySize.height + buttonSize.height + VERTICAL_SPACE*bodySize.height)); + btnUp=CreateButton(AnchorPoint::TOP_LEFT, posUp, "Up", selectedColor, unSelectedColor, buttonSize); + btnUp.ClickedSignal().Connect(this,&TBTDaliKeyBoardFocusManagerView::OnUpClick); + ctlBody.Add(btnUp); + + Vector2 textEditorSize=Vector2(0.7f*bodySize.width, 2.0f*TEXTEDITOR_HEIGHT*bodySize.height); + + Vector2 posEditor=Vector2(0.3f*bodySize.width/2, bodySize.height - (BUTTON_HEIGHT*bodySize.height + VERTICAL_SPACE*bodySize.height + buttonSize.height + VERTICAL_SPACE*bodySize.height+ VERTICAL_SPACE*bodySize.height + textEditorSize.height)); + + Control ctlEditor=CreateTextEditor(AnchorPoint::TOP_LEFT,ParentOrigin::TOP_LEFT,posEditor,"",textEditorSize); + ctlBody.Add(ctlEditor); + + txt_editor=TextEditor::DownCast(ctlEditor.GetChildAt(0)); + txt_editor.TextChangedSignal().Connect(this,&TBTDaliKeyBoardFocusManagerView::onTextChanged); + PushButton button=PushButton::DownCast(ctlEditor.GetChildAt(1)); + button.ClickedSignal().Connect(this, &TBTDaliKeyBoardFocusManagerView::OnButtonClick); + + Vector2 textFieldSize=Vector2(0.7f*bodySize.width, TEXTFIELD_HEIGHT*bodySize.height); + Vector2 pos=Vector2(0.3f*bodySize.width/2, bodySize.height - (BUTTON_HEIGHT*bodySize.height + VERTICAL_SPACE*bodySize.height + buttonSize.height + VERTICAL_SPACE*bodySize.height+ VERTICAL_SPACE*bodySize.height + textEditorSize.height + 2*VERTICAL_SPACE*bodySize.height + textFieldSize.height)); + Control txtField=CreateTextField(AnchorPoint::TOP_LEFT,ParentOrigin::TOP_LEFT,pos,"",textFieldSize); + ctlBody.Add(txtField); + + txt_field=TextField::DownCast(txtField.GetChildAt(0)); + PushButton button1=PushButton::DownCast(txtField.GetChildAt(1)); + button1.ClickedSignal().Connect(this, &TBTDaliKeyBoardFocusManagerView::OnButtonClick_1); + + lblPreFocus.SetKeyboardFocusable(true); + lblFocusChange.SetKeyboardFocusable(true); + lblFocusGroup.SetKeyboardFocusable(true); + lblFocusActor.SetKeyboardFocusable(true); + + txt_editor.SetKeyboardFocusable(true); + txt_field.SetKeyboardFocusable(true); + btnUp.SetKeyboardFocusable(true); + btnDown.SetKeyboardFocusable(true); + + mFocusManager.SetAsFocusGroup(ctlBody,true); - mrootTable.SetKeyboardFocusable( true ); mFocusManager.PreFocusChangeSignal().Connect( this, &TBTDaliKeyBoardFocusManagerView::OnPreFocusChange ); mFocusManager.FocusChangedSignal().Connect( this, &TBTDaliKeyBoardFocusManagerView::OnFocusChanged ); mFocusManager.FocusGroupChangedSignal().Connect( this, &TBTDaliKeyBoardFocusManagerView::OnFocusGroupChanged ); mFocusManager.FocusedActorEnterKeySignal().Connect( this, &TBTDaliKeyBoardFocusManagerView::OnFocusedActorEnterKey ); -} -template -PushButton TBTDaliKeyBoardFocusManagerView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) +} +bool TBTDaliKeyBoardFocusManagerView::OnButtonClick(Button button) +{ + DBG("TBTDaliKeyBoardFocusManagerView::OnButtonClick"); + txt_editor.SetProperty(TextEditor::Property::TEXT,""); + return true; +} +bool TBTDaliKeyBoardFocusManagerView::OnButtonClick_1(Button button) { - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; + DBG("TBTDaliKeyBoardFocusManagerView::OnButtonClick_1"); + txt_field.SetProperty(TextEditor::Property::TEXT,""); + return true; } -TextLabel TBTDaliKeyBoardFocusManagerView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) +void TBTDaliKeyBoardFocusManagerView::onTextChanged(TextEditor editor) { - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; + DBG("TBTDaliKeyBoardFocusManagerView::onTextChanged"); +} +bool TBTDaliKeyBoardFocusManagerView::onKeyEventSignal(Control control, const KeyEvent& event) +{ + DBG("TBTDaliKeyBoardFocusManagerView::onKeyEventSignal"); + return true; } Actor TBTDaliKeyBoardFocusManagerView::OnPreFocusChange(Actor current, Actor proposed, Control::KeyboardFocus::Direction direction) { DBG("In TBTDaliKeyBoardFocusManagerView::OnPreFocusChange"); - lblPreFocus.SetProperty(TextLabel::Property::TEXT," Pre focus signal called"); + lblPreFocus.SetProperty(TextLabel::Property::TEXT,"Pre focus signal called"); lblPreFocus.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); -// if ( !current && !proposed ) -// { -// return mrootTable; -// } - return proposed; } void TBTDaliKeyBoardFocusManagerView::OnFocusChanged(Actor current, Actor proposed) { DBG("In TBTDaliKeyBoardFocusManagerView::OnFocusChanged"); - lblFocusChange.SetProperty(TextLabel::Property::TEXT," Focus change signal called"); + lblFocusChange.SetProperty(TextLabel::Property::TEXT,"Focus change signal called"); lblFocusChange.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } void TBTDaliKeyBoardFocusManagerView::OnFocusGroupChanged(Actor actor, bool bValue) { DBG("In TBTDaliKeyBoardFocusManagerView::OnFocusGroupChanged"); - lblFocusGroup.SetProperty(TextLabel::Property::TEXT," Focus group change signal called"); + lblFocusGroup.SetProperty(TextLabel::Property::TEXT,"Focus group change signal called"); lblFocusGroup.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } void TBTDaliKeyBoardFocusManagerView::OnFocusedActorEnterKey(Actor actor) { DBG("In TBTDaliKeyBoardFocusManagerView::OnFocusedActorEnterKey"); - lblFocusActor.SetProperty(TextLabel::Property::TEXT," Focus actor key signal called"); + lblFocusActor.SetProperty(TextLabel::Property::TEXT,"Focus actor key signal called"); lblFocusActor.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } bool TBTDaliKeyBoardFocusManagerView::OnUpClick(Button button) { DBG("In TBTDaliKeyBoardFocusManagerView::OnUpClick"); //mFocusManager.MoveFocus(Control::KeyboardFocus::UP); - mFocusManager.SetCurrentFocusActor(txt1); + mFocusManager.SetCurrentFocusActor(txt_field); //txt1.SetKeyInputFocus(); //mFocusManager.SetCurrentFocusActor(mrootTable); return true; @@ -167,7 +147,7 @@ bool TBTDaliKeyBoardFocusManagerView::OnDownClick(Button button) { DBG("In TBTDaliKeyBoardFocusManagerView::OnDownClick"); //mFocusManager.MoveFocus(Control::KeyboardFocus::DOWN); - mFocusManager.SetCurrentFocusActor(txt2); + mFocusManager.SetCurrentFocusActor(txt_editor); //txt2.SetKeyInputFocus(); //mFocusManager.SetFocusIndicatorActor(txt2); return true; diff --git a/tbtcoreapp-dali/src/view/tbt-dali-scroll-bar-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-scroll-bar-view.cpp deleted file mode 100644 index 5fccd36..0000000 --- a/tbtcoreapp-dali/src/view/tbt-dali-scroll-bar-view.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "view/tbt-dali-scroll-bar-view.h" - -TBTDaliScrollBarView::TBTDaliScrollBarView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { - - CommonView::Initialize(); - - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); - - mrootTable= TableView::New(7, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - //mrootTable.SetKeyboardFocusable(true); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); - - mStage.Add(mrootTable); - Vector2 size(512,512); - - lblScrollBar=CreateTextLabel(mrootTable,TableView::CellPosition(2,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblScrollBar.SetProperty(TextLabel::Property::TEXT,"Pan finished signal not call"); - lblScrollBar.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblScrollBar.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblScrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblPreFocus.SetKeyboardFocusable(true); - - std::string str="Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..." - "Hello dali..."; - - txtEditor=TextEditor::New(); - txtEditor.SetProperty(TextEditor::Property::TEXT,str); - txtEditor.SetSize(mStageSize.width,500.0f); - mrootTable.AddChild( txtEditor, TableView::CellPosition( 3, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 3, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); - - - scrollBar = ScrollBar::New(Toolkit::ScrollBar::Vertical); - scrollBar.SetParentOrigin(ParentOrigin::TOP_RIGHT); - scrollBar.SetAnchorPoint(AnchorPoint::TOP_RIGHT); - scrollBar.SetResizePolicy(Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT); - scrollBar.SetIndicatorFixedHeight(150.0f); - scrollBar.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::WIDTH); - txtEditor.Add(scrollBar); - scrollBar.PanFinishedSignal().Connect(this, &TBTDaliScrollBarView::OnPanFinishedSignal); -} - -template -PushButton TBTDaliScrollBarView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliScrollBarView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; -} -void TBTDaliScrollBarView::OnPanFinishedSignal() -{ - DBG("In TBTDaliScrollBarView::OnPanFinishedSignal"); - this->lblScrollBar.SetProperty( TextLabel::Property::TEXT, "Pan finished signal called" ); - //this->lblStyleManager.SetProperty( TextLabel::Property::POINT_SIZE, 8.0f ); - this->lblScrollBar.SetProperty( TextLabel::Property::TEXT_COLOR,Color::GREEN); -} - diff --git a/tbtcoreapp-dali/src/view/tbt-dali-scroll-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-scroll-view.cpp index 78ef8a2..54e657c 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-scroll-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-scroll-view.cpp @@ -1,8 +1,12 @@ #include "view/tbt-dali-scroll-view.h" TBTDaliScrollView::TBTDaliScrollView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { - CommonView::Initialize(); + UiUtils(mApplication, _control) { + + Init("Scroll View");//initialize the common view + mInfoText="Testing Dali Scroll View Functionality"; + + Stage stage = Stage::GetCurrent(); NUM_IMAGES = 14; @@ -14,33 +18,34 @@ TBTDaliScrollView::TBTDaliScrollView(Application& mApplication, app_control_h _c } // Create a ScrollView instance ScrollView scrollView = ScrollView::New(); - scrollView.SetParentOrigin( ParentOrigin::CENTER ); - Stage stage = Stage::GetCurrent(); - stage.Add(scrollView); + scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); + scrollView.SetParentOrigin( ParentOrigin::TOP_LEFT ); + scrollView.SetPosition(0.0f, 0.0f); + ctlBody.Add(scrollView); // Set the size of scrollView; it covers the entire stage - Size size = stage.GetSize(); - scrollView.SetSize(size.width, size.height - this->GetVerdictTableHeight()); + Size scrollViewSize = Vector2(bodySize.width, bodySize.height); + scrollView.SetSize(scrollViewSize); // Add actors to the ScrollView for( int i = 0; i < NUM_IMAGES; ++i ) { - AddImage( scrollView, size, i ); + AddImage( scrollView, scrollViewSize, i ); } // The ScrollView contents are now draggable // To enforce horizontal-only scrolling, the Y axis ruler can be disabled + RulerPtr rulerY = new DefaultRuler(); rulerY->Disable(); scrollView.SetRulerY( rulerY ); // A domain can be applied to rulers to prevent scrolling beyond this boundary // In this case, to 4 times the width of the stage, allowing for 4 pages to be scrolled - RulerPtr rulerX2 = new FixedRuler( size.width ); - rulerX2->SetDomain( RulerDomain( 0.0f, size.width*NUM_IMAGES ) ); + RulerPtr rulerX2 = new FixedRuler( scrollViewSize.width ); + rulerX2->SetDomain( RulerDomain( 0.0f, scrollViewSize.width*NUM_IMAGES ) ); scrollView.SetRulerX( rulerX2 ); - scrollView.SnapStartedSignal().Connect(this, &TBTDaliScrollView::SnapStartedSignalCallback); scrollView.SetScrollingDirection(Radian(0)); @@ -50,58 +55,62 @@ TBTDaliScrollView::TBTDaliScrollView(Application& mApplication, app_control_h _c scrollView.SetMaxOvershoot(1, 1); scrollView.SetAxisAutoLock(true); - scrollView.RemoveScrollingDirection( Radian(0)); + //scrollView.RemoveScrollingDirection( Radian(0)); if(scrollView.GetAxisAutoLock() == false) { DBG("Error"); } scrollBar = ScrollBar::New(Toolkit::ScrollBar::Horizontal); - scrollBar.SetParentOrigin(ParentOrigin::TOP_RIGHT); - scrollBar.SetAnchorPoint(AnchorPoint::TOP_RIGHT); + scrollBar.SetParentOrigin(ParentOrigin::TOP_LEFT); + scrollBar.SetAnchorPoint(AnchorPoint::TOP_LEFT); scrollBar.SetResizePolicy(Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT); //scrollBar.SetIndicatorFixedHeight(500.0f); scrollBar.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::WIDTH); - scrollView.Add(scrollBar); scrollBar.PanFinishedSignal().Connect(this, &TBTDaliScrollView::OnPanFinishedSignal); + scrollView.Add(scrollBar); - lblSnap=TextLabel::New(""); - lblSnap.SetAnchorPoint(AnchorPoint::TOP_LEFT); - lblPan=TextLabel::New(""); - lblPan.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Property::Map ctl; + ctl["lbl1"]=" Snap started signal not call"; + ctl["lbl2"]=" Pan finished signal not call"; + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + + CreateLabelList(ctl,size);//create textlabel list + lblSnap=TextLabel::DownCast(ctlBody.GetChildAt(1)); + lblPan=TextLabel::DownCast(ctlBody.GetChildAt(2)); } void TBTDaliScrollView::OnPanFinishedSignal() { DBG("In TBTDaliScrollView::OnPanFinishedSignal"); - lblPan.SetPosition(0,GetVerdictTableHeight()); - this->lblPan.SetProperty( TextLabel::Property::TEXT, "Pan finished signal called" ); + this->lblPan.SetProperty( TextLabel::Property::TEXT, " Pan finished signal called" ); //this->lblStyleManager.SetProperty( TextLabel::Property::POINT_SIZE, 8.0f ); this->lblPan.SetProperty( TextLabel::Property::TEXT_COLOR,Color::GREEN); - Stage::GetCurrent().Add(lblPan); } void TBTDaliScrollView::SnapStartedSignalCallback(const ScrollView::SnapEvent& event) { DBG("TBTDaliScrollView::SnapStartedSignalCallback"); - lblSnap.SetPosition(0,2*GetVerdictTableHeight()); - this->lblSnap.SetProperty( TextLabel::Property::TEXT, "Snap started signal called" ); - //this->lblStyleManager.SetProperty( TextLabel::Property::POINT_SIZE, 8.0f ); - this->lblSnap.SetProperty( TextLabel::Property::TEXT_COLOR,Color::GREEN); - Stage::GetCurrent().Add(lblSnap); + if(!this->lblSnap) + DBG("Unable to access the lblSnap textlabel"); + this->lblSnap.SetProperty( TextLabel::Property::TEXT, " Snap started signal called" ); + this->lblSnap.SetProperty( TextLabel::Property::TEXT_COLOR, Color::GREEN); } -void TBTDaliScrollView::AddImage( ScrollView& scrollView, Size& stageSize, int index ) +void TBTDaliScrollView::AddImage( ScrollView& scrollView, Size& size, int index ) { Image image = ResourceImage::New( IMAGE_PATHS[index]); ImageView imageViewTest = ImageView::New( image ); ImageView imageView = ImageView::New(); +// imageView.SetAnchorPoint(AnchorPoint::TOP_LEFT); +// imageView.SetParentOrigin( ParentOrigin::TOP_LEFT ); + imageView.SetParentOrigin( ParentOrigin::CENTER ); + imageView.SetAnchorPoint( AnchorPoint::CENTER ); imageView.SetImage(imageViewTest.GetImage()); imageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); imageView.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); + imageView.SetPosition( index * size.x, 0 ); - imageView.SetParentOrigin( ParentOrigin::CENTER ); - imageView.SetAnchorPoint( AnchorPoint::CENTER ); - - imageView.SetPosition( index * stageSize.x, 0 ); scrollView.Add( imageView ); } diff --git a/tbtcoreapp-dali/src/view/tbt-dali-slider-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-slider-view.cpp index f2c0254..9761a73 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-slider-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-slider-view.cpp @@ -1,44 +1,32 @@ #include "view/tbt-dali-slider-view.h" TBTDaliSliderView::TBTDaliSliderView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { + UiUtils(mApplication, _control) { - CommonView::Initialize(); + Init("Slider");//initialize the common view + mInfoText="Testing Dali Slider Functionality"; - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); - mrootTable= TableView::New(7, 2); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); - mStage.Add(mrootTable); + Property::Map ctl; + ctl["lbl1"]=" Slider value changed signal not call"; + ctl["lbl2"]=" Slider finished signal not call"; + ctl["lbl3"]=" Slider mark reached signal not call"; - Vector2 size(512,512); + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl3"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); - txtValueChanged=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Button click signal not call",size); - txtValueChanged.SetProperty(TextLabel::Property::TEXT,"Slider value changed signal not call"); - txtValueChanged.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - txtValueChanged.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - txtValueChanged.SetAnchorPoint(AnchorPoint::TOP_LEFT); - - txtFinished=CreateTextLabel(mrootTable,TableView::CellPosition(2,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Button press signal not call",size); - txtFinished.SetProperty(TextLabel::Property::TEXT,"Slider finished signal not call"); - txtFinished.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - txtFinished.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - txtFinished.SetAnchorPoint(AnchorPoint::TOP_LEFT); - - txtMarkReached=CreateTextLabel(mrootTable,TableView::CellPosition(3,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Button release signal not call",size); - txtMarkReached.SetProperty(TextLabel::Property::TEXT,"Slider mark reached signal not call"); - txtMarkReached.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - txtMarkReached.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - txtMarkReached.SetAnchorPoint(AnchorPoint::TOP_LEFT); + CreateLabelList(ctl,size);//create textlabel list + txtValueChanged=TextLabel::DownCast(ctlBody.GetChildAt(0)); + txtFinished=TextLabel::DownCast(ctlBody.GetChildAt(1)); + txtMarkReached=TextLabel::DownCast(ctlBody.GetChildAt(2)); slider=Slider::New(); - slider.SetParentOrigin( ParentOrigin::CENTER ); - slider.SetAnchorPoint( AnchorPoint::CENTER ); + slider.SetParentOrigin( ParentOrigin::TOP_LEFT ); + slider.SetAnchorPoint( AnchorPoint::TOP_LEFT ); slider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); slider.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); Property::Array array; @@ -50,76 +38,35 @@ TBTDaliSliderView::TBTDaliSliderView(Application& mApplication, app_control_h _c slider.ValueChangedSignal().Connect( this, &TBTDaliSliderView::onValueChanged ); slider.SlidingFinishedSignal().Connect( this, &TBTDaliSliderView::onSliningFinished ); slider.MarkReachedSignal().Connect( this, &TBTDaliSliderView::onMarkReached ); - - //Setup slider cell properties - mrootTable.AddChild( slider, TableView::CellPosition( 5, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 5, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); - - txtValue = TextLabel::New(); - txtValue.SetParentOrigin( ParentOrigin::CENTER ); - txtValue.SetAnchorPoint( AnchorPoint::CENTER ); - txtValue.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - - //Setup slider-label cell properties - mrootTable.AddChild( txtValue, TableView::CellPosition( 5, 1 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 5, 1 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); - - mStage.Add( mrootTable ); + slider.SetSize(bodySize.width/2,bodySize.height*TEXTLABEL_HEIGHT); + slider.SetPosition(20*(bodySize.width*HORIZONTAL_SPACE), bodySize.height/2); + //slider.SetPosition(300,300); + ctlBody.Add(slider); + //ctlBody.Add(txtValue); } -template -PushButton TBTDaliSliderView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliSliderView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; -} bool TBTDaliSliderView::onValueChanged(Slider slider,float value) { DBG("TBTDaliSliderView::onValueChanged"); - txtValueChanged.SetProperty(TextLabel::Property::TEXT,"Slider value changed signal called"); + txtValueChanged.SetProperty(TextLabel::Property::TEXT," Slider value changed signal called"); txtValueChanged.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); - txtValue.SetProperty(TextLabel::Property::TEXT,FloatToString(value)); - txtValue.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); + //txtValue.SetProperty(TextLabel::Property::TEXT,FloatToString(value)); + //txtValue.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); return true; } bool TBTDaliSliderView::onSliningFinished(Slider slider,float value) { DBG("TBTDaliSliderView::onSliningFinished"); - txtFinished.SetProperty(TextLabel::Property::TEXT,"Slider finished signal called"); + txtFinished.SetProperty(TextLabel::Property::TEXT," Slider finished signal called"); txtFinished.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); return true; } bool TBTDaliSliderView::onMarkReached(Slider slider,int value) { DBG("TBTDaliSliderView::onMarkReached"); - txtMarkReached.SetProperty(TextLabel::Property::TEXT,"Slider mark reached signal called"); + txtMarkReached.SetProperty(TextLabel::Property::TEXT," Slider mark reached signal called"); txtMarkReached.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); return true; } diff --git a/tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp index bde5341..9113b6e 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-stage-view.cpp @@ -1,72 +1,86 @@ #include "view/tbt-dali-stage-view.h" -Application gApplication; +//Application gApplication; +TextField txt; TBTDaliStageView::TBTDaliStageView(Application& mApplication, app_control_h _control, std::string msg) : - CommonView(mApplication, _control) { - - gApplication=mApplication; - CommonView::Initialize(); - - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); - bCheck=false; - - mrootTable= TableView::New(12, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mStage.Add(mrootTable); - - Vector2 size(512,512); - - txtContext=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Context lost signal not call",size); - txtContextRegain=CreateTextLabel(mrootTable,TableView::CellPosition(2,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Context regain signal not call",size); - txtEventProcessing=CreateTextLabel(mrootTable,TableView::CellPosition(3,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Event Processing signal not call",size); - txtKeyEvent=CreateTextLabel(mrootTable,TableView::CellPosition(4,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Key Event signal not call",size); - txtSceneCreated=CreateTextLabel(mrootTable,TableView::CellPosition(5,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Scene created signal not call",size); - txtTouched=CreateTextLabel(mrootTable,TableView::CellPosition(6,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Touched signal not call",size); - txtTouch= CreateTextLabel(mrootTable,TableView::CellPosition(7,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Touch signal not call",size); - txtWheel=CreateTextLabel(mrootTable,TableView::CellPosition(8,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Wheel event signal not call",size); - - Dali::Toolkit::TextEditor txtEditor=Dali::Toolkit::TextEditor::New(); - txtEditor.SetProperty(TextEditor::Property::TEXT,"Please edit text here.."); - mrootTable.AddChild(txtEditor,TableView::CellPosition(9,0)); - - btnTestButton = PushButton::New(); - btnTestButton.SetProperty(Button::Property::LABEL_TEXT,"Mouse wheel & add/remove test button"); - btnTestButton.SetSize(Vector2(mStage.GetSize().width,GetVerdictTableHeight())); - btnTestButton.SetBackgroundColor(Color::CYAN); - btnTestButton.SetColor(Color::CYAN); - btnTestButton.WheelEventSignal().Connect(this,&TBTDaliStageView::onWheelEvent); + UiUtils(mApplication, _control) { + + //gApplication=mApplication; + Init("Stage");//initialize the common view + mInfoText="Testing Stage Functionality"; + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); + + Property::Map ctl; + ctl["lbl1"]="Context lost signal not call"; + ctl["lbl2"]="Context regain signal not call"; + ctl["lbl3"]="Event Processing signal not call"; + ctl["lbl4"]="Key Event signal not call"; + ctl["lbl5"]="Scene created signal not call"; + ctl["lbl6"]="Touched signal not call"; + ctl["lbl7"]="Touch signal not call"; + ctl["lbl8"]="Wheel event signal not call"; + + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl3"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl4"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl5"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl6"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl7"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl8"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + + CreateLabelList(ctl,size);//create textlabel list + + txtContext=TextLabel::DownCast(ctlBody.GetChildAt(0)); + txtContextRegain=TextLabel::DownCast(ctlBody.GetChildAt(1)); + txtEventProcessing=TextLabel::DownCast(ctlBody.GetChildAt(2)); + txtKeyEvent=TextLabel::DownCast(ctlBody.GetChildAt(3)); + txtSceneCreated=TextLabel::DownCast(ctlBody.GetChildAt(4)); + txtTouched=TextLabel::DownCast(ctlBody.GetChildAt(5)); + txtTouch=TextLabel::DownCast(ctlBody.GetChildAt(6)); + txtWheel=TextLabel::DownCast(ctlBody.GetChildAt(7)); + + Vector2 buttonSize=Vector2(bodySize.width, 2.0f*BUTTON_HEIGHT*bodySize.height); + Vector2 position=Vector2(0.0f, bodySize.height - (buttonSize.height + VERTICAL_SPACE*bodySize.height)); + btnTestButton=CreateButton(AnchorPoint::TOP_LEFT, position, "Test mouse wheel here", selectedColor, unSelectedColor, buttonSize); + //btnTestButton.WheelEventSignal().Connect(this,&TBTDaliStageView::onWheelEvent); btnTestButton.ClickedSignal().Connect(this,&TBTDaliStageView::OnButtonClicked); - mrootTable.AddChild(btnTestButton,TableView::CellPosition(10,0)); + ctlBody.Add(btnTestButton); if(msg=="onSceneCreated") { - txtSceneCreated.SetProperty(TextLabel::Property::TEXT,"Scene created event is called"); + txtSceneCreated.SetProperty(TextLabel::Property::TEXT," Scene created event is called"); txtSceneCreated.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } - mStage.ContextLostSignal().Connect(this,&TBTDaliStageView::onContextLost); - mStage.ContextRegainedSignal().Connect(this,&TBTDaliStageView::onContextRegain); - mStage.EventProcessingFinishedSignal().Connect(this,&TBTDaliStageView::onEventProcessing); - mStage.KeyEventSignal().Connect(this,&TBTDaliStageView::onKeyEvent); + Vector2 pos=Vector2(0.3f*bodySize.width/2, bodySize.height - (BUTTON_HEIGHT*bodySize.height + VERTICAL_SPACE*bodySize.height + buttonSize.height + VERTICAL_SPACE*bodySize.height)); + Control txtField=CreateTextField(AnchorPoint::TOP_LEFT,ParentOrigin::TOP_LEFT,pos,"",Vector2(0.7f*bodySize.width,TEXTFIELD_HEIGHT*bodySize.height)); + ctlBody.Add(txtField); + + PushButton btn=PushButton::DownCast(txtField.GetChildAt(1)); + btn.ClickedSignal().Connect(this,&TBTDaliStageView::OnButtonClick); + + txt=TextField::DownCast(txtField.GetChildAt(0)); + + stage.ContextLostSignal().Connect(this,&TBTDaliStageView::onContextLost); + stage.ContextRegainedSignal().Connect(this,&TBTDaliStageView::onContextRegain); + stage.EventProcessingFinishedSignal().Connect(this,&TBTDaliStageView::onEventProcessing); + stage.KeyEventSignal().Connect(this,&TBTDaliStageView::onKeyEvent); //mStage.SceneCreatedSignal().Connect(this,&TBTDaliStageView::onSceneCreated); - mStage.TouchedSignal().Connect(this,&TBTDaliStageView::onTouchedEvent); - mStage.TouchSignal().Connect(this,&TBTDaliStageView::onTouchEvent); - //mStage.WheelEventSignal().Connect(this,&TBTDaliStageView::onWheelEvent); - - //Atlas -// mAtlas = Atlas::New( 400,700, Pixel::RGBA8888); -// mAtlas.Clear(Vector4(0.f,0.5f,0.5f,0.25f)); -// UploadBufferImages(); -// UploadPixelData(); -// imageView = Toolkit::ImageView::New( mAtlas ); -// mrootTable.AddChild(imageView,TableView::CellPosition(11,0)); - - mStage.Add( mrootTable ); + stage.TouchedSignal().Connect(this,&TBTDaliStageView::onTouchedEvent); + stage.TouchSignal().Connect(this,&TBTDaliStageView::onTouchEvent); + stage.WheelEventSignal().Connect(this,&TBTDaliStageView::onStageWheelEvent); +} +bool TBTDaliStageView::OnButtonClick(Button button) +{ + DBG("In TBTDaliStageView::OnButtonClick"); + txt.SetProperty(TextField::Property::TEXT,""); + return true; } + //BufferImage TBTDaliStageView::CreateBufferImage( const Vector4& color, const unsigned int width, const unsigned int height ) //{ // BufferImage imageData = BufferImage::New( width, height, Pixel::RGBA8888 ); @@ -99,87 +113,63 @@ TBTDaliStageView::TBTDaliStageView(Application& mApplication, app_control_h _con void TBTDaliStageView::NewWindow(void) { PositionSize posSize(100, 100, 720, 1280); - gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window + //gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window } -template -PushButton TBTDaliStageView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliStageView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; -} void TBTDaliStageView::onKeyEvent(const KeyEvent& keyevent) { DBG("In TBTDaliStageView::onKeyEvent"); - txtKeyEvent.SetProperty(TextLabel::Property::TEXT,"Key event is called"); + txtKeyEvent.SetProperty(TextLabel::Property::TEXT," Key event is called"); txtKeyEvent.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } void TBTDaliStageView::onEventProcessing() { DBG("In TBTDaliStageView::onEventProcessing"); - txtEventProcessing.SetProperty(TextLabel::Property::TEXT,"Event processing signal is called"); + txtEventProcessing.SetProperty(TextLabel::Property::TEXT," Event processing signal is called"); txtEventProcessing.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } void TBTDaliStageView::onTouchedEvent(const TouchEvent& touchevent) { DBG("In TBTDaliStageView::onTaouchedEvent"); - txtTouched.SetProperty(TextLabel::Property::TEXT,"Touched event is called"); + txtTouched.SetProperty(TextLabel::Property::TEXT," Touched event is called"); txtTouched.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } void TBTDaliStageView::onTouchEvent(const TouchData& touchdata) { DBG("In TBTDaliStageView::onTouchEvrnt"); - txtTouch.SetProperty(TextLabel::Property::TEXT,"Touch event is called"); + txtTouch.SetProperty(TextLabel::Property::TEXT," Touch event is called"); txtTouch.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } -bool TBTDaliStageView::onWheelEvent( Actor actor, const WheelEvent& wheelevent) +bool TBTDaliStageView::onWheelEvent(Actor actor, const WheelEvent& wheelevent) { DBG("In TBTDaliStageView::onWheelEvent"); - txtWheel.SetProperty(TextLabel::Property::TEXT,"Wheel event is called"); + txtWheel.SetProperty(TextLabel::Property::TEXT," Wheel event is called"); txtWheel.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); return true; } +void TBTDaliStageView::onStageWheelEvent( const WheelEvent& wheelevent) +{ + DBG("In TBTDaliStageView::onStageWheelEvent"); + txtWheel.SetProperty(TextLabel::Property::TEXT," Wheel event is called"); + txtWheel.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); +} + void TBTDaliStageView::onContextLost() { DBG("In TBTDaliStageView::cbContextLost"); - txtContext.SetProperty(TextLabel::Property::TEXT,"Context lost event is called"); + txtContext.SetProperty(TextLabel::Property::TEXT," Context lost event is called"); txtContext.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } void TBTDaliStageView::onContextRegain() { DBG("In TBTDaliStageView::onContextRegain"); - txtContextRegain.SetProperty(TextLabel::Property::TEXT,"Context regain event is called"); + txtContextRegain.SetProperty(TextLabel::Property::TEXT," Context regain event is called"); txtContextRegain.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } void TBTDaliStageView::onSceneCreated() { DBG("In TBTDaliStageView::onSceneCreated"); - txtSceneCreated.SetProperty(TextLabel::Property::TEXT,"Scene created event is called"); + txtSceneCreated.SetProperty(TextLabel::Property::TEXT," Scene created event is called"); txtSceneCreated.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } bool TBTDaliStageView::OnButtonClicked(Button button) { diff --git a/tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp index e7e771a..4a7135c 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-style-manager-view.cpp @@ -1,72 +1,33 @@ #include "view/tbt-dali-style-manager-view.h" TBTDaliStyleManagerView::TBTDaliStyleManagerView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { + UiUtils(mApplication, _control) { - CommonView::Initialize(); + Init("Style Manager"); + mInfoText="Testing Dali Style Manager Functionality"; - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); - mrootTable= TableView::New(9, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - //mrootTable.SetKeyboardFocusable(true); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); + Property::Map ctl; + Property::Map size; - mStage.Add(mrootTable); - Vector2 size(512,512); + ctl["lbl1"]="Style changed signal not call"; - lblStyleManager=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblStyleManager.SetProperty(TextLabel::Property::TEXT,"Style changed signal not call"); - lblStyleManager.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblStyleManager.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblStyleManager.SetAnchorPoint(AnchorPoint::TOP_LEFT); - //lblPreFocus.SetKeyboardFocusable(true); + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + CreateLabelList(ctl,size);//create textlabel list + lblStyleManager=TextLabel::DownCast(ctlBody.GetChildAt(0)); - btnStyle=CreateButton(mrootTable, TableView::CellPosition(7, 0), - AnchorPoint::BOTTOM_LEFT, AnchorPoint::BOTTOM_LEFT, "Style Change", - this, &TBTDaliStyleManagerView::OnClicked, - Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),Vector2(mStageSize.width,GetVerdictTableHeight())); + Vector2 buttonSize=Vector2(bodySize.width, BUTTON_HEIGHT*bodySize.height); + Vector2 position=Vector2(0.0f, bodySize.height - (buttonSize.height + VERTICAL_SPACE*bodySize.height)); + btnStyle=CreateButton(AnchorPoint::TOP_LEFT, position, "Style change", selectedColor, unSelectedColor, buttonSize); + ctlBody.Add(btnStyle); + btnStyle.ClickedSignal().Connect(this, &TBTDaliStyleManagerView::OnClicked); styleManager=StyleManager::Get(); styleManager.StyleChangedSignal().Connect(this, &TBTDaliStyleManagerView::OnStyleChange); - } -template -PushButton TBTDaliStyleManagerView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliStyleManagerView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; -} bool TBTDaliStyleManagerView::OnClicked(Button button) { DBG("In TBTDaliStyleManagerView::OnClicked"); diff --git a/tbtcoreapp-dali/src/view/tbt-dali-text-control-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-text-control-view.cpp index d571255..577a058 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-text-control-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-text-control-view.cpp @@ -1,105 +1,80 @@ #include "view/tbt-dali-text-control-view.h" TBTDaliTextControlView::TBTDaliTextControlView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { + UiUtils(mApplication, _control) { - CommonView::Initialize(); + Init("Text Control");//initialize the common view + mInfoText="Testing Dali Text Control Functionality"; - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Stage stage = Stage::GetCurrent(); - mrootTable= TableView::New(8, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); - mStage.Add(mrootTable); + Property::Map ctl; + ctl["lbl1"]="Text field max length(10) reached signal not call"; + ctl["lbl2"]="Text editor text changed signal not call"; + ctl["lbl3"]="Key Event signal not call"; - Vector2 size(512,512); + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl2"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + size["lbl3"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); - lblField=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"",size); - lblField.SetProperty(TextLabel::Property::TEXT,"Text field max length reached signal not call"); - lblField.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblField.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblField.SetAnchorPoint(AnchorPoint::TOP_LEFT); + CreateLabelList(ctl,size);//create textlabel list + lblField=TextLabel::DownCast(ctlBody.GetChildAt(0)); + lblEditor=TextLabel::DownCast(ctlBody.GetChildAt(1)); + lblKeyEvent=TextLabel::DownCast(ctlBody.GetChildAt(2)); - lblEditor=CreateTextLabel(mrootTable,TableView::CellPosition(2,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Button press signal not call",size); - lblEditor.SetProperty(TextLabel::Property::TEXT,"Text editor text changed signal not call"); - lblEditor.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblEditor.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblEditor.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Vector2 textEditorSize=Vector2(0.7f*bodySize.width, 3.0f*TEXTEDITOR_HEIGHT*bodySize.height); - lblKeyEvent=CreateTextLabel(mrootTable,TableView::CellPosition(3,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Button press signal not call",size); - lblKeyEvent.SetProperty(TextLabel::Property::TEXT,"Key Event signal not call"); - lblKeyEvent.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - lblKeyEvent.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - lblKeyEvent.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Vector2 posEditor=Vector2(0.3f*bodySize.width/2, bodySize.height - (textEditorSize.height + VERTICAL_SPACE*bodySize.height)); + Control ctlEditor=CreateTextEditor(AnchorPoint::TOP_LEFT,ParentOrigin::TOP_LEFT,posEditor,"",textEditorSize); + ctlBody.Add(ctlEditor); - txtField=TextField::New(); - txtField.SetProperty(TextField::Property::TEXT,"Type here.."); - txtField.SetProperty(TextField::Property::MAX_LENGTH,15); - txtField.MaxLengthReachedSignal().Connect(this,&TBTDaliTextControlView::onMaxLengthReached); - txtField.KeyEventSignal().Connect(this, &TBTDaliTextControlView::onKeyEventSignal); - mrootTable.AddChild( txtField, TableView::CellPosition( 4, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 4, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + editor=TextEditor::DownCast(ctlEditor.GetChildAt(0)); + editor.TextChangedSignal().Connect(this,&TBTDaliTextControlView::onTextChanged); + PushButton button=PushButton::DownCast(ctlEditor.GetChildAt(1)); + button.ClickedSignal().Connect(this, &TBTDaliTextControlView::OnButtonClick); - txtEditor=TextEditor::New(); - txtEditor.SetProperty(TextEditor::Property::TEXT,"Type here.."); - txtEditor.TextChangedSignal().Connect(this,&TBTDaliTextControlView::onTextChanged); - mrootTable.AddChild( txtEditor, TableView::CellPosition( 5, 0 ) ); - mrootTable.SetCellAlignment( TableView::CellPosition( 5, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); + Vector2 textFieldSize=Vector2(0.7f*bodySize.width, TEXTFIELD_HEIGHT*bodySize.height); + Vector2 pos=Vector2(0.3f*bodySize.width/2, bodySize.height - (VERTICAL_SPACE*bodySize.height + textEditorSize.height + 6.0f*VERTICAL_SPACE*bodySize.height + textFieldSize.height)); + Control txtField=CreateTextField(AnchorPoint::TOP_LEFT,ParentOrigin::TOP_LEFT,pos,"",textFieldSize); + ctlBody.Add(txtField); - mStage.Add( mrootTable ); + field=TextField::DownCast(txtField.GetChildAt(0)); + field.SetProperty(TextField::Property::MAX_LENGTH, 10); + field.MaxLengthReachedSignal().Connect(this,&TBTDaliTextControlView::onMaxLengthReached); + field.KeyEventSignal().Connect(this, &TBTDaliTextControlView::onKeyEventSignal); + PushButton button1=PushButton::DownCast(txtField.GetChildAt(1)); + button1.ClickedSignal().Connect(this, &TBTDaliTextControlView::OnButtonClick1); } - -template -PushButton TBTDaliTextControlView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) +bool TBTDaliTextControlView::OnButtonClick(Button button) { - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; + DBG("TBTDaliTextControlView::OnButtonClick"); + editor.SetProperty(TextEditor::Property::TEXT,""); + return true; } -TextLabel TBTDaliTextControlView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) +bool TBTDaliTextControlView::OnButtonClick1(Button button) { - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; + DBG("TBTDaliTextControlView::OnButtonClick1"); + field.SetProperty(TextField::Property::TEXT,""); + return true; } + void TBTDaliTextControlView::onMaxLengthReached(TextField field) { DBG("TBTDaliTextControlView::onMaxLengthReached"); - lblField.SetProperty(TextLabel::Property::TEXT,"Text field max length reached signal called"); + lblField.SetProperty(TextLabel::Property::TEXT," Text field max length reached signal called"); lblField.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } void TBTDaliTextControlView::onTextChanged(TextEditor editor) { DBG("TBTDaliTextControlView::onTextChanged"); - lblEditor.SetProperty(TextLabel::Property::TEXT,"Text editor text changed signal called"); + lblEditor.SetProperty(TextLabel::Property::TEXT," Text editor text changed signal called"); lblEditor.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); } bool TBTDaliTextControlView::onKeyEventSignal(Control control, const KeyEvent& event) { DBG("TBTDaliSliderView::onKeyEventSignal"); - lblKeyEvent.SetProperty(TextLabel::Property::TEXT,"KeyEvent signal called"); + lblKeyEvent.SetProperty(TextLabel::Property::TEXT," KeyEvent signal called"); lblKeyEvent.SetProperty(TextLabel::Property::TEXT_COLOR,Color::GREEN); return true; } diff --git a/tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp index 7e20345..516f7eb 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-touch-data-view.cpp @@ -79,63 +79,22 @@ std::string GetTouchDataPointState ( PointState::Type state ) return str; } TBTDaliTouchDataView::TBTDaliTouchDataView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { + UiUtils(mApplication, _control) { - CommonView::Initialize(); + Init("Touch Data");//initialize the common view + mInfoText="Testing Dali Touch Data Functionality"; - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Stage stage = Stage::GetCurrent(); - mrootTable= TableView::New(8, 1); - mrootTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mrootTable.SetSize(mStageSize.width, mStageSize.height - GetVerdictTableHeight()); - mrootTable.SetPosition(0 , 0); - mrootTable.SetName("RootTable"); - //mrootTable.SetFixedHeight(1, mStageSize.height - GetVerdictTableHeight()); - mStage.Add(mrootTable); + Property::Map ctl; + ctl["lbl1"]=" Touch event not call"; - Vector2 size(512,512); + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, 6.0f*TEXTLABEL_HEIGHT * bodySize.height); - txtTouch=CreateTextLabel(mrootTable,TableView::CellPosition(1,0),AnchorPoint::TOP_LEFT,AnchorPoint::BOTTOM_LEFT,"Context lost signal not call",size); - txtTouch.SetProperty(TextLabel::Property::TEXT,"Touch event not call"); - txtTouch.SetProperty(TextLabel::Property::TEXT_COLOR,Color::RED); - txtTouch.SetSize(mStageSize.width,mStageSize.height - GetVerdictTableHeight()); - txtTouch.SetAnchorPoint(AnchorPoint::TOP_LEFT); - mStage.TouchSignal().Connect(this,&TBTDaliTouchDataView::onTouchEvent); - - mStage.Add( mrootTable ); -} - -template -PushButton TBTDaliTouchDataView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) -{ - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; -} -TextLabel TBTDaliTouchDataView::CreateTextLabel(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string txt, Vector2 size ) -{ - TextLabel txtLabel=TextLabel::New(txt); - //txtLabel.SetSize(size); - //txtLabel.SetAnchorPoint(anchorPoint); - //txtLabel.SetPosition(position); - txtLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT,"LEFT"); - txtLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT,"TOP"); - txtLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::RED); - txtLabel.SetProperty(TextLabel::Property::MULTI_LINE, true); - parent.AddChild(txtLabel,cellPosition); - return txtLabel; + CreateLabelList(ctl,size);//create textlabel list + txtTouch=TextLabel::DownCast(ctlBody.GetChildAt(0)); + stage.TouchSignal().Connect(this,&TBTDaliTouchDataView::onTouchEvent); } void TBTDaliTouchDataView::onTouchEvent(const TouchData& touchdata) diff --git a/tbtcoreapp-dali/src/view/tbt-dali-tts-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-tts-view.cpp index 1a4cc46..d2f5798 100644 --- a/tbtcoreapp-dali/src/view/tbt-dali-tts-view.cpp +++ b/tbtcoreapp-dali/src/view/tbt-dali-tts-view.cpp @@ -1,76 +1,91 @@ #include "view/tbt-dali-tts-view.h" TBTTTSView::TBTTTSView(Application& mApplication, app_control_h _control) : - CommonView(mApplication, _control) { - CommonView::Initialize(); + UiUtils(mApplication, _control) { - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); + Init("TTS Player");//initialize the common view + mInfoText="Testing Dali TTS Player Functionality"; + Stage stage = Stage::GetCurrent(); + + Property::Map ctl; + ctl["lbl1"]=" TTS player status"; + + Property::Map size; + size["lbl1"]=Vector2(bodySize.width, TEXTLABEL_HEIGHT * bodySize.height); + + CreateLabelList(ctl,size);//create textlabel list + lblTTS=TextLabel::DownCast(ctlBody.GetChildAt(0)); + + //textfield + Vector2 textFieldSize=Vector2(0.9f*bodySize.width, TEXTFIELD_HEIGHT*bodySize.height); + Vector2 pos=Vector2(0.1f*bodySize.width/2, bodySize.height/2); + Control txtField=CreateTextField(AnchorPoint::TOP_LEFT,ParentOrigin::TOP_LEFT,pos,"",textFieldSize); + ctlBody.Add(txtField); + txtTTS=TextField::DownCast(txtField.GetChildAt(0)); + txtTTS.SetProperty(TextField::Property::TEXT, "The quick brown fox jumps over the lazy dog"); + txtTTS.SetProperty(TextField::Property::POINT_SIZE, 7); + PushButton button=PushButton::DownCast(txtField.GetChildAt(1)); + button.ClickedSignal().Connect(this, &TBTTTSView::OnButtonClick); + + //play, pause, stop container TableView controlTable = TableView::New(1, 3); - controlTable.SetAnchorPoint(AnchorPoint::BOTTOM_LEFT); - controlTable.SetSize(mStageSize.width, GetVerdictTableHeight()); - controlTable.SetPosition(0, mStageSize.height - GetVerdictTableHeight()); - mStage.Add(controlTable); - - Vector2 size(mStageSize.width / 3, GetVerdictTableHeight()); - - playButton = CreateButton(controlTable, TableView::CellPosition(0, 0), - AnchorPoint::BOTTOM_LEFT, AnchorPoint::BOTTOM_LEFT, "Play", - this, &TBTTTSView::OnPlayButtonClicked, - Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); - interruptButton = CreateButton(controlTable, - TableView::CellPosition(0, 1), AnchorPoint::BOTTOM_LEFT, - AnchorPoint::BOTTOM_LEFT, "Pause", this, - &TBTTTSView::OnInterruptButtonClicked, - Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); - stopButton = CreateButton(controlTable, - TableView::CellPosition(0, 2), AnchorPoint::BOTTOM_LEFT, - AnchorPoint::BOTTOM_LEFT, "Stop", this, - &TBTTTSView::OnStopButtonClicked, Vector4(0.55f, 0.8f, 0.9f, 1.0f), - Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); - - txt = CreateTextField( - Vector2(mStageSize.width, GetVerdictTableHeight() * 2), "TBT"); - mStage.Add(txt); + controlTable.SetAnchorPoint(AnchorPoint::TOP_LEFT); + controlTable.SetParentOrigin(ParentOrigin::TOP_LEFT); + controlTable.SetSize(footerSize); + controlTable.SetPosition(0.0f, bodySize.height - footerSize.height); + ctlBody.Add(controlTable); + + //play, pause, stop + Vector2 buttonSize(bodySize.width / 3, footerSize.height); + Vector4 selectedColor = Vector4(0.55f, 0.8f, 0.9f, 1.0f); + Vector4 unselectedColor = Vector4(0.8f, 0.9f, 0.9f, 1.0f); + + playButton = CreateButton(AnchorPoint::BOTTOM_LEFT, Vector2(0.0f, 0.0f), "Play", + selectedColor, unselectedColor, buttonSize); + playButton.ClickedSignal().Connect(this, &TBTTTSView::OnPlayButtonClicked); + + interruptButton = CreateButton(AnchorPoint::BOTTOM_LEFT, Vector2(0.0f, 0.0f), "Pause", + selectedColor, unselectedColor, buttonSize); + interruptButton.ClickedSignal().Connect(this, &TBTTTSView::OnInterruptButtonClicked); + + stopButton = CreateButton(AnchorPoint::BOTTOM_LEFT, Vector2(0.0f, 0.0f), "Stop", + selectedColor, unselectedColor,buttonSize); + stopButton.ClickedSignal().Connect(this, &TBTTTSView::OnStopButtonClicked); + + controlTable.AddChild(playButton, TableView::CellPosition(0,0)); + controlTable.AddChild(interruptButton, TableView::CellPosition(0,1)); + controlTable.AddChild(stopButton, TableView::CellPosition(0,2)); tts = TtsPlayer::Get(); updateViewControls(); } - -template -PushButton TBTTTSView::CreateButton(TableView parent, TableView::CellPosition cellPosition, - Vector3 anchorPoint, Vector3 position, std::string label, X* obj, - Ret (X::*onClickedCallback)(Arg0 arg0), Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) +bool TBTTTSView::OnButtonClick(Button button) { - Stage mStage = Stage::GetCurrent(); - Vector2 mStageSize = mStage.GetSize(); - - PushButton button = PushButton::New(); - button.SetAnchorPoint(anchorPoint); - button.SetPosition(position); - button.SetSize(size); - button.SetLabelText(label); - button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); - button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); - parent.AddChild(button, cellPosition); - - button.ClickedSignal().Connect(obj, onClickedCallback); - return button; + DBG("TBTTTSView::OnButtonClick"); + txtTTS.SetProperty(TextField::Property::TEXT, ""); + return true; } -void TBTTTSView::updateViewControls() { - if (tts.GetState() == TtsPlayer::PLAYING) { +void TBTTTSView::updateViewControls() +{ + DBG("TBTTTSView::updateViewControls"); + if (tts.GetState() == TtsPlayer::PLAYING) + { playButton.SetDisabled(true); interruptButton.SetDisabled(false); interruptButton.SetLabelText("Pause"); stopButton.SetDisabled(false); - } else if (tts.GetState() == TtsPlayer::PAUSED) { + } + else if (tts.GetState() == TtsPlayer::PAUSED) + { playButton.SetDisabled(true); interruptButton.SetDisabled(false); interruptButton.SetLabelText("Resume"); stopButton.SetDisabled(false); - } else { + } + else + { playButton.SetDisabled(false); interruptButton.SetDisabled(true); stopButton.SetDisabled(true); @@ -78,32 +93,66 @@ void TBTTTSView::updateViewControls() { } -bool TBTTTSView::OnPlayButtonClicked(Button button) { - if (tts.GetState() == TtsPlayer::READY) { +bool TBTTTSView::OnPlayButtonClicked(Button button) +{ + DBG("TBTTTSView::OnPlayButtonClicked"); + if (tts.GetState() == TtsPlayer::READY) + { std::string text; - - txt.GetProperty(TextField::Property::TEXT).Get(text); + txtTTS.GetProperty(TextField::Property::TEXT).Get(text); tts.Play(text); + if (tts.GetState() == TtsPlayer::PLAYING) + { + DBG("TtsPlayer::PLAYING"); + lblTTS.SetProperty(TextLabel::Property::TEXT," TTS player status: PLAYING"); + lblTTS.SetProperty(TextLabel::Property::TEXT_COLOR, Color::CYAN); + } } updateViewControls(); return true; } -bool TBTTTSView::OnInterruptButtonClicked(Button button) { - - if (tts.GetState() == TtsPlayer::PLAYING) { +bool TBTTTSView::OnInterruptButtonClicked(Button button) +{ + DBG("TBTTTSView::OnInterruptButtonClicked"); + if (tts.GetState() == TtsPlayer::PLAYING) + { + DBG("TtsPlayer::PLAYING"); tts.Pause(); - } else if (tts.GetState() == TtsPlayer::PAUSED) { + if (tts.GetState() == TtsPlayer::PAUSED) + { + DBG("TtsPlayer::PAUSED"); + lblTTS.SetProperty(TextLabel::Property::TEXT," TTS player status: PAUSED"); + lblTTS.SetProperty(TextLabel::Property::TEXT_COLOR, Color::CYAN); + } + } + else if (tts.GetState() == TtsPlayer::PAUSED) + { + DBG("TtsPlayer::PAUSED"); tts.Resume(); + if (tts.GetState() == TtsPlayer::PLAYING) + { + DBG("TtsPlayer::PLAYING"); + lblTTS.SetProperty(TextLabel::Property::TEXT," TTS player status: PLAYING"); + lblTTS.SetProperty(TextLabel::Property::TEXT_COLOR, Color::CYAN); + } } updateViewControls(); return true; } -bool TBTTTSView::OnStopButtonClicked(Button button) { - - if (tts.GetState() != TtsPlayer::UNAVAILABLE) { +bool TBTTTSView::OnStopButtonClicked(Button button) +{ + DBG("TBTTTSView::OnStopButtonClicked"); + if (tts.GetState() != TtsPlayer::UNAVAILABLE) + { tts.Stop(); + if (tts.GetState() == TtsPlayer::READY) + { + DBG("TtsPlayer::READY"); + lblTTS.SetProperty(TextLabel::Property::TEXT," TTS player status: READY"); + lblTTS.SetProperty(TextLabel::Property::TEXT_COLOR, Color::CYAN); + } } updateViewControls(); return true; diff --git a/tbtcoreapp/inc/model/tbt-info.h b/tbtcoreapp/inc/model/tbt-info.h index 7efc3ce..4a7031c 100644 --- a/tbtcoreapp/inc/model/tbt-info.h +++ b/tbtcoreapp/inc/model/tbt-info.h @@ -253,7 +253,9 @@ typedef enum { TBT_APP_DALI_GESTURE_DETECTOR, - TBT_APP_DALI_STYLE_MANAGER + TBT_APP_DALI_STYLE_MANAGER, + + TBT_APP_DALI_APP //TBT_APP_DALI_SCROLL_BAR @@ -433,7 +435,8 @@ static char *feature_list[1024] = "tizen.org/feature/network.bluetooth.health", "tizen.org/feature/sensor.barometer", "tizen.org/feature/network.wifi.direct.display", - "tizen.org/feature/network.internet" + "tizen.org/feature/network.internet", + "tizen.org/feature/notification" }; #endif /* __TBT_INFO_H__ */ diff --git a/tbtcoreapp/inc/utils/app_module_config.h b/tbtcoreapp/inc/utils/app_module_config.h index 0f38993..a54d454 100644 --- a/tbtcoreapp/inc/utils/app_module_config.h +++ b/tbtcoreapp/inc/utils/app_module_config.h @@ -229,6 +229,7 @@ #define TBT_MODULE_DALI +#define TBT_MODULE_APP_DALI_APP #define TBT_MODULE_APP_DALI_ACTOR #define TBT_MODULE_APP_DALI_STAGE #define TBT_MODULE_APP_DALI_TOUCH_DATA diff --git a/tbtcoreapp/src/model/tbt-list.c b/tbtcoreapp/src/model/tbt-list.c index e4876f7..9adad80 100644 --- a/tbtcoreapp/src/model/tbt-list.c +++ b/tbtcoreapp/src/model/tbt-list.c @@ -2262,6 +2262,20 @@ static tbt_info tbtapps[] = .features_required = {11} }, #endif + #ifdef TBT_MODULE_APP_DALI_APP + + //DALi Test + { + .name = "DALi App", + .parent = "DALi", + .apptype = TBT_APP_DALI_APP, + .icon_name = "dummy", + .info = "DALi Application Functionality", + .result = 0, + .required_features_count = 1, + .features_required = {11} + }, + #endif // #ifdef TBT_MODULE_APP_DALI_SCROLL_BAR // // //DALi Test diff --git a/tbtcoreapp/src/view/tbt-bluetoothle-view.c b/tbtcoreapp/src/view/tbt-bluetoothle-view.c index 3ab97ef..d5f7e2b 100644 --- a/tbtcoreapp/src/view/tbt-bluetoothle-view.c +++ b/tbtcoreapp/src/view/tbt-bluetoothle-view.c @@ -1850,7 +1850,7 @@ static void _bt_gatt_server_read_value_requested_cb(const char *remote_address, char char_value_1[4] = {65, 66, 67,0}; int resp_status = BT_ERROR_NONE; - int result = bt_gatt_server_send_response(request_id, BLUETOOTH_GATT_REQUEST_TYPE_READ, offset, resp_status, char_value_1, 3 - offset); + int result = bt_gatt_server_send_response(request_id, BT_GATT_REQUEST_TYPE_READ, offset, resp_status, char_value_1, 3 - offset); DBG("bt_gatt_server_send_response %s", get_bluetooth_error(result)); str = format_string("response sent %s", char_value_1); @@ -1910,7 +1910,7 @@ static void _bt_gatt_server_write_value_requested_cb(const char *remote_address, SAFE_DELETE(str); bt_gatt_server_send_response(request_id, - BLUETOOTH_GATT_REQUEST_TYPE_WRITE, offset, + BT_GATT_REQUEST_TYPE_WRITE, offset, resp_status, NULL, 0); elm_list_go(this->bluetoothle_list); diff --git a/tbtcoreapp/src/view/tbt-genlist-view.c b/tbtcoreapp/src/view/tbt-genlist-view.c index b1c124f..4d25fef 100644 --- a/tbtcoreapp/src/view/tbt-genlist-view.c +++ b/tbtcoreapp/src/view/tbt-genlist-view.c @@ -1125,6 +1125,9 @@ static void _gl_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void case TBT_APP_DALI_STYLE_MANAGER: dali_view_add(view->navi, info, it, "TBT_APP_DALI_STYLE_MANAGER"); break; + case TBT_APP_DALI_APP: + dali_view_add(view->navi, info, it, "TBT_APP_DALI_APP"); + break; // case TBT_APP_DALI_SCROLL_BAR: // dali_view_add(view->navi, info, it, "TBT_APP_DALI_SCROLL_BAR"); // break;