--- /dev/null
+Flora License
+
+Version 1.0, May, 2012
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Compatibility Definition Document
+and passes the Compatibility Test Suite as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+ 1. You must give any other recipients of the Work or Derivative Works
+ a copy of this License; and
+ 2. You must cause any modified files to carry prominent notices stating
+ that You changed the files; and
+ 3. You must retain, in the Source form of any Derivative Works that
+ You distribute, all copyright, patent, trademark, and attribution
+ notices from the Source form of the Work, excluding those notices
+ that do not pertain to any part of the Derivative Works; and
+ 4. If the Work includes a "NOTICE" text file as part of its distribution,
+ then any Derivative Works that You distribute must include a readable
+ copy of the attribution notices contained within such NOTICE file,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works, in at least one of the following places:
+ within a NOTICE text file distributed as part of the Derivative Works;
+ within the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the Derivative Works,
+ if and wherever such third-party notices normally appear.
+ The contents of the NOTICE file are for informational purposes only
+ and do not modify the License.
+
+You may add Your own attribution notices within Derivative Works
+that You distribute, alongside or as an addendum to the NOTICE text
+from the Work, provided that such additional attribution notices
+cannot be construed as modifying the License. You may add Your own
+copyright statement to Your modifications and may provide additional or
+different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works
+as a whole, provided Your use, reproduction, and distribution of
+the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Flora License, Version 1.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://floralicense.org/license/
+
+ 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.
+
--- /dev/null
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Flora License, Version 1.
+Please, see the LICENSE file for Flora License terms and conditions.
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet type="text/xsl" href="../../../../description.xsl"?>
+
+<Overview version="0.17.1">
+ <SampleName> UiGestureDetector </SampleName>
+ <SampleVersion>1.0</SampleVersion>
+ <Preview>screenshot.png</Preview>
+ <Description>
+The purpose of this application is checking that TouchGestureDetector works properly.
+ </Description>
+</Overview>
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _BASE_FORM_H_
+#define _BASE_FORM_H_
+
+#include <FUi.h>
+#include <FGraphics.h>
+#include <FMedia.h>
+#include <FSystem.h>
+
+class BaseForm
+ : public Tizen::Ui::Controls::Form
+ , public Tizen::Ui::IActionEventListener
+ , public Tizen::Ui::Controls::IFormBackEventListener
+{
+public:
+ BaseForm(void);
+ virtual ~BaseForm(void);
+
+ virtual bool Initialize(void) = 0;
+ bool SetFooter(void);
+
+ virtual result OnInitializing(void);
+ void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+ void OnFormBackRequested(Tizen::Ui::Controls::Form& source) ;
+
+ static const int ID_EXIT = 100;
+ static const int CLEAR_BUTTON_POS_X = 380;
+ static const int CLEAR_BUTTON_POS_Y = 550;
+ static const int CLEAR_BUTTON_WIDTH = 80;
+ static const int CLEAR_BUTTON_HEIGHT= 60;
+ static const int TOUCH_AREA_MARGIN = 5;
+ static const int TOUCH_AREA_WIDTH = 400;
+ static const int TOUCH_RESULT_WIDTH = 300;
+ static const int CANVAS_POS_Y = 225;
+ static const int CONDITION_WIDTH = 200;
+ static const int CONDITION_HEIGHT = 60;
+};
+#endif //_BASE_FORM_H_
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef FORMFACTORY_H_
+#define FORMFACTORY_H_
+
+#include <FUiScenesIFormFactory.h>
+
+class FormFactory: public Tizen::Ui::Scenes::IFormFactory {
+public:
+ FormFactory();
+ virtual ~FormFactory();
+
+ virtual Tizen::Ui::Controls::Form* CreateFormN(const Tizen::Base::String &formId, const Tizen::Ui::Scenes::SceneId &sceneId);
+};
+
+#endif /* FORMFACTORY_H_ */
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _MAIN_FORM_H_
+#define _MAIN_FORM_H_
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FUi.h>
+#include <FGraphics.h>
+
+class MainForm
+ : public Tizen::Ui::Controls::Form
+ , public Tizen::Ui::Controls::IListViewItemEventListener
+ , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+ MainForm(void);
+ virtual ~MainForm(void);
+ bool Initialize(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual int GetItemCount(void);
+ virtual Tizen::Ui::Controls::ListItemBase* CreateItem (int index, int itemWidth);
+ virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
+ virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
+ virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
+ virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
+ virtual void OnItemReordered(Tizen::Ui::Controls::ListView& view, int oldIndex, int newIndex);
+
+ void InitializeListViewMainMenuNameArray(void);
+ void InitializeHeader(void);
+ void InitializeListViewMainMenu(void);
+
+private:
+ static const int LIST_VIEW_MAIN_MENU_COUNT = 7;
+ Tizen::Ui::Controls::Header* __pHeader;
+ Tizen::Ui::Controls::ListView* __pListViewMainMenu;
+ Tizen::Base::String __listViewMainMenuNameArray[LIST_VIEW_MAIN_MENU_COUNT];
+};
+#endif //_MAIN_FORM_H_
\ No newline at end of file
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _SAMPLE_CUSTOM_GESTURE_DETECTOR_H_
+#define _SAMPLE_CUSTOM_GESTURE_DETECTOR_H_
+
+#include <FUiITouchCustomGestureEventListener.h>
+#include "BaseForm.h"
+
+class SampleCustomGestureDetector
+ : public Tizen::Ui::TouchGestureDetector
+{
+public:
+ SampleCustomGestureDetector(const Tizen::Graphics::Rectangle &rect);
+ virtual ~SampleCustomGestureDetector(void);
+
+ void AddEventListener(Tizen::Ui::ITouchCustomGestureEventListener& listener);
+ void RemoveEventListener(Tizen::Ui::ITouchCustomGestureEventListener& listener);
+
+ virtual void OnTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchCanceled(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchInfo);
+
+private:
+ double GetAngle(int x1, int y1, int x2, int y2) const;
+
+private:
+ Tizen::Graphics::Point __previousPoint;
+ Tizen::Graphics::Point __startPoint;
+ Tizen::Graphics::Point __centerPoint;
+ Tizen::Graphics::Rectangle __touchAreaBounds;
+ int __fingerCount;
+ bool __directionChanged;
+};
+#endif //_SAMPLE_CUSTOM_GESTURE_DETECTOR_H_
\ No newline at end of file
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _SAMPLE_CUSTOM_GESTURE_DETECTOR_FORM_H_
+#define _SAMPLE_CUSTOM_GESTURE_DETECTOR_FORM_H_
+
+#include <FUiITouchCustomGestureEventListener.h>
+#include "SampleCustomGestureDetector.h"
+#include "BaseForm.h"
+#include "TouchAreaPanel.h"
+
+class SampleCustomGestureDetectorForm
+ : public BaseForm
+ , public Tizen::Ui::ITouchCustomGestureEventListener
+{
+public:
+ SampleCustomGestureDetectorForm(void);
+ virtual ~SampleCustomGestureDetectorForm(void);
+
+ virtual bool Initialize(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnCustomGestureStarted(Tizen::Ui::TouchGestureDetector& gestureDetector);
+ virtual void OnCustomGestureChanged(Tizen::Ui::TouchGestureDetector& gestureDetector);
+ virtual void OnCustomGestureFinished(Tizen::Ui::TouchGestureDetector& gestureDetector);
+ virtual void OnCustomGestureCanceled(Tizen::Ui::TouchGestureDetector& gestureDetector);
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+ Tizen::Ui::Controls::Panel* GetTouchArea(void);
+
+private:
+ static const int ID_BUTTON_CLEAR = 101;
+ static const int TOUCH_RESULT_POS_Y = 550;
+ static const int TOUCH_RESULT_HEIGHT = 60;
+ static const int DECRIPTION_HEIGHT = 100;
+ TouchAreaPanel* __pTouchArea;
+ Tizen::Ui::Controls::Label* __pTouchResult;
+ Tizen::Ui::Controls::Button* __pClearButton;
+ SampleCustomGestureDetector* __pCustomGesture;
+};
+#endif //_SAMPLE_CUSTOM_GESTURE_DETECTOR_FORM_H_
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _SAMPLE_FLICK_GESTURE_DETECTOR_FORM_H_
+#define _SAMPLE_FLICK_GESTURE_DETECTOR_FORM_H_
+
+#include "FUiITouchFlickGestureEventListener.h"
+#include "BaseForm.h"
+#include "TouchAreaPanel.h"
+
+class SampleFlickGestureDetectorForm
+ : public BaseForm
+ , public Tizen::Ui::ITouchEventListener
+ , public Tizen::Ui::ITouchFlickGestureEventListener
+{
+public:
+ SampleFlickGestureDetectorForm(void);
+ virtual ~SampleFlickGestureDetectorForm(void);
+
+ virtual bool Initialize(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnFlickGestureDetected(Tizen::Ui::TouchFlickGestureDetector& gestureDetector);
+ virtual void OnFlickGestureCanceled(Tizen::Ui::TouchFlickGestureDetector& gestureDetector);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+
+private:
+ static const int ID_BUTTON_CLEAR = 101;
+ static const int TITLE_WIDTH = 150;
+ static const int TITLE_HEIGHT = 50;
+ static const int DECRIPTION_POS_Y = 420;
+ static const int CONDITION_AREA_POS_X = 200;
+ static const int CONDITION_AREA_POS_Y = 480;
+ static const int TOUCH_RESULT_POS_Y = 530;
+ TouchAreaPanel* __pTouchArea;
+ Tizen::Ui::Controls::Label* __pTouchResult;
+ Tizen::Ui::Controls::Button* __pClearButton;
+ Tizen::Ui::Controls::Label* __pDirectionTitle;
+ Tizen::Ui::Controls::Label* __pDirection;
+ Tizen::Ui::Controls::Label* __pDistanceTitle;
+ Tizen::Ui::Controls::Label* __pDistance;
+ Tizen::Ui::TouchFlickGestureDetector* __pFlickGesture;
+};
+#endif //_SAMPLE_FLICK_GESTURE_DETECTOR_FORM_H_
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _SAMPLE_LONG_PRESS_GESTURE_DETECTOR_FORM_H_
+#define _SAMPLE_LONG_PRESS_GESTURE_DETECTOR_FORM_H_
+
+#include "FUiITouchLongPressGestureEventListener.h"
+#include "BaseForm.h"
+#include "TouchAreaPanel.h"
+
+class SampleLongPressGestureDetectorForm
+ : public BaseForm
+ , public Tizen::Ui::ITouchLongPressGestureEventListener
+ , public Tizen::Ui::ITouchEventListener
+ , public Tizen::Ui::ITextEventListener
+{
+public:
+ SampleLongPressGestureDetectorForm(void);
+ virtual ~SampleLongPressGestureDetectorForm(void);
+
+ virtual bool Initialize(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnLongPressGestureDetected(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector);
+ virtual void OnLongPressGestureCanceled(Tizen::Ui::TouchLongPressGestureDetector& gestureDetector);
+
+ virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
+ virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+
+private:
+ static const int ID_BUTTON_CLEAR = 101;
+ static const int CONDITION_POS_Y = 70;
+ static const int CONDITION_POS_X = 210;
+ static const int TOUCH_AREA_POS_Y = 530;
+ static const int TOUCH_RESULT_HEIGHT = 100;
+ static const int CANVAS_HEIGHT = 300;
+ static const int DURATION_MAX =6;
+ static const int TOUCH_COUNT_MAX =2;
+ Tizen::Ui::Controls::Label* __pDurationLabel;
+ Tizen::Ui::Controls::Label* __pFingerCountLabel;
+ Tizen::Ui::Controls::EditField* __pDuration;
+ Tizen::Ui::Controls::EditField* __pFingerCount;
+ TouchAreaPanel* __pTouchArea;
+ Tizen::Ui::Controls::Label* __pTouchResult;
+ Tizen::Ui::Controls::Button* __pClearButton;
+ Tizen::Ui::TouchLongPressGestureDetector* __pLongPressGesture;
+ int __previousDuration;
+ int __previousTouchCount;
+};
+#endif //_SAMPLE_LONG_PRESS_GESTURE_DETECTOR_FORM_H_
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _SAMPLE_PANNING_GESTURE_DETECTOR_FORM_H_
+#define _SAMPLE_PANNING_GESTURE_DETECTOR_FORM_H_
+
+#include "FUiITouchPanningGestureEventListener.h"
+#include "BaseForm.h"
+#include "TouchAreaPanel.h"
+
+class SamplePanningGestureDetectorForm
+ : public BaseForm
+ , public Tizen::Ui::ITouchPanningGestureEventListener
+ , public Tizen::Ui::ITouchEventListener
+ , public Tizen::Ui::ITextEventListener
+{
+public:
+ SamplePanningGestureDetectorForm(void);
+ virtual ~SamplePanningGestureDetectorForm(void);
+
+ virtual bool Initialize(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnPanningGestureStarted(Tizen::Ui::TouchPanningGestureDetector& gestureDetector);
+ virtual void OnPanningGestureChanged(Tizen::Ui::TouchPanningGestureDetector& gestureDetector);
+ virtual void OnPanningGestureFinished(Tizen::Ui::TouchPanningGestureDetector& gestureDetector);
+ virtual void OnPanningGestureCanceled(Tizen::Ui::TouchPanningGestureDetector& gestureDetector);
+
+ virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
+ virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+
+private:
+ static const int ID_BUTTON_CLEAR = 101;
+ static const int TOUCH_RESULT_HEIGHT = 100;
+ static const int TOUCH_RESULT_POS_Y = 530;
+ static const int TOUCH_AREA_POS_Y = 70;
+ static const int CONDITION_POS_X = 210;
+ static const int TOUCH_COUNT_MAX =2;
+ TouchAreaPanel* __pTouchArea;
+ Tizen::Ui::Controls::Label* __pTouchResult;
+ Tizen::Ui::Controls::Label* __pTouchCountTitle;
+ Tizen::Ui::Controls::EditField* __pTouchCount;
+ Tizen::Ui::Controls::Button* __pClearButton;
+ Tizen::Ui::TouchPanningGestureDetector* __pPanningGesture;
+ int __previousTouchCount;
+};
+#endif //_SAMPLE_PANNING_GESTURE_DETECTOR_FORM_H_
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _SAMPLE_PINCH_GESTURE_DETECTOR_FORM_H_
+#define _SAMPLE_PINCH_GESTURE_DETECTOR_FORM_H_
+
+#include "FUiITouchPinchGestureEventListener.h"
+#include "BaseForm.h"
+#include "TouchAreaPanel.h"
+
+class SamplePinchGestureDetectorForm
+ : public BaseForm
+ , public Tizen::Ui::ITouchPinchGestureEventListener
+ , public Tizen::Ui::ITouchEventListener
+{
+public:
+ SamplePinchGestureDetectorForm(void);
+ virtual ~SamplePinchGestureDetectorForm(void);
+
+ virtual bool Initialize(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnPinchGestureStarted(Tizen::Ui::TouchPinchGestureDetector& gestureDetector);
+ virtual void OnPinchGestureChanged(Tizen::Ui::TouchPinchGestureDetector& gestureDetector);
+ virtual void OnPinchGestureFinished(Tizen::Ui::TouchPinchGestureDetector& gestureDetector);
+ virtual void OnPinchGestureCanceled(Tizen::Ui::TouchPinchGestureDetector& gestureDetector);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+
+private:
+ void DisplayInformation(Tizen::Ui::TouchPinchGestureDetector& gestureDetector);
+
+private:
+ static const int ID_BUTTON_CLEAR = 101;
+ static const int SCALE_RESULT_POS_X = 200;
+ static const int SCALE_RESULT_POS_Y = 420;
+ static const int CENTER_RESULT_POS_X = 200;
+ static const int CENTERX_RESULT_POS_Y = 470;
+ static const int CENTERY_RESULT_POS_Y = 520;
+ static const int TOUCH_RESULT_POS_Y = 570;
+ TouchAreaPanel* __pTouchArea;
+ Tizen::Ui::Controls::Label* __pTouchResult;
+ Tizen::Ui::Controls::Button* __pClearButton;
+ Tizen::Ui::Controls::Label* __pScaleTitle;
+ Tizen::Ui::Controls::Label* __pScale;
+ Tizen::Ui::Controls::Label* __pCenterPositionXTitle;
+ Tizen::Ui::Controls::Label* __pCenterPositionYTitle;
+ Tizen::Ui::Controls::Label* __pCenterPositionX;
+ Tizen::Ui::Controls::Label* __pCenterPositionY;
+ Tizen::Ui::TouchPinchGestureDetector* __pPinchGesture;
+};
+#endif //_SAMPLE_PINCH_GESTURE_DETECTOR_FORM_H_
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _SAMPLE_ROTATION_GESTURE_DETECTOR_FORM_H_
+#define _SAMPLE_ROTATION_GESTURE_DETECTOR_FORM_H_
+
+#include "FUiITouchRotationGestureEventListener.h"
+#include "BaseForm.h"
+#include "TouchAreaPanel.h"
+
+class SampleRotationGestureDetectorForm
+ : public BaseForm
+ , public Tizen::Ui::ITouchRotationGestureEventListener
+ , public Tizen::Ui::ITouchEventListener
+{
+public:
+ SampleRotationGestureDetectorForm(void);
+ virtual ~SampleRotationGestureDetectorForm(void);
+
+ virtual bool Initialize(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnRotationGestureStarted(Tizen::Ui::TouchRotationGestureDetector& gestureDetector);
+ virtual void OnRotationGestureChanged(Tizen::Ui::TouchRotationGestureDetector& gestureDetector);
+ virtual void OnRotationGestureFinished(Tizen::Ui::TouchRotationGestureDetector& gestureDetector);
+ virtual void OnRotationGestureCanceled(Tizen::Ui::TouchRotationGestureDetector& gestureDetector);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+
+private:
+ static const int ID_BUTTON_CLEAR = 101;
+ Tizen::Ui::Controls::Label* __pTouchResult;
+ Tizen::Ui::Controls::Label* __pDistanceTitle;
+ Tizen::Ui::Controls::Label* __pAngleTitle;
+ Tizen::Ui::Controls::Label* __pDistance;
+ Tizen::Ui::Controls::Label* __pAngle;
+ Tizen::Ui::Controls::Button* __pClearButton;
+ Tizen::Ui::TouchRotationGestureDetector* __pRotationGesture;
+ TouchAreaPanel* __pTouchArea;
+};
+#endif //_SAMPLE_ROTATION_GESTURE_DETECTOR_FORM_H_
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _SAMPLE_TAP_GESTURE_DETECTOR_FORM_H_
+#define _SAMPLE_TAP_GESTURE_DETECTOR_FORM_H_
+
+#include "FUiITouchTapGestureEventListener.h"
+#include "BaseForm.h"
+#include "TouchAreaPanel.h"
+
+class SampleTapGestureDetectorForm
+ : public BaseForm
+ , public Tizen::Ui::ITouchTapGestureEventListener
+ , public Tizen::Ui::ITouchEventListener
+ , public Tizen::Ui::ITextEventListener
+{
+public:
+ SampleTapGestureDetectorForm(void);
+ virtual ~SampleTapGestureDetectorForm(void);
+
+ virtual bool Initialize(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnTapGestureDetected(Tizen::Ui::TouchTapGestureDetector& gestureDetector);
+ virtual void OnTapGestureCanceled(Tizen::Ui::TouchTapGestureDetector& gestureDetector);
+
+ virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
+ virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+ virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
+
+private:
+ static const int ID_BUTTON_CLEAR = 101;
+ static const int TOUCH_RESULT_HEIGHT = 100;
+ static const int TOUCH_RESULT_POS_Y = 530;
+ static const int TOUCH_AREA_POS_Y = 225;
+ static const int TOUCH_AREA_HEIGHT = 300;
+ static const int INTERVAL_CONDITION_POS_X = 210;
+ static const int TAP_COUNT_CONDITION_POS_Y = 70;
+ static const int FINGER_COUNT_CONDITION_POS_X = 210;
+ static const int FINGER_COUNT_CONDITION_POS_Y = 135;
+ static const int CANVAS_WIDTH = 300;
+ static const int INTERVAL_MAX = 6;
+ static const int TAP_COUNT_MAX = 2;
+ static const int TOUCH_COUNT_MAX = 2;
+ Tizen::Ui::Controls::Label* __pIntervalLabel;
+ Tizen::Ui::Controls::Label* __pTapCountLabel;
+ Tizen::Ui::Controls::Label* __pFingerCountLabel;
+ Tizen::Ui::Controls::EditField* __pInterval;
+ Tizen::Ui::Controls::EditField* __pTapCount;
+ Tizen::Ui::Controls::EditField* __pFingerCount;
+ TouchAreaPanel* __pTouchArea;
+ Tizen::Ui::Controls::Label* __pTouchResult;
+ Tizen::Ui::Controls::Button* __pClearButton;
+ Tizen::Ui::TouchTapGestureDetector* __pTapGesture;
+ int __previousInterval;
+ int __previousTapCount;
+ int __previousTouchCount;
+ bool __gestureDetected;
+};
+#endif //_SAMPLE_TAP_GESTURE_DETECTOR_FORM_H_
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _TOUCH_AREA_PANEL_H_
+#define _TOUCH_AREA_PANEL_H_
+
+#include <FGraphics.h>
+#include <FUi.h>
+
+class TouchAreaPanel
+ : public Tizen::Ui::Controls::Panel
+{
+public:
+ TouchAreaPanel();
+ virtual ~TouchAreaPanel();
+
+ result Initialize(const Tizen::Graphics::Rectangle& rect);
+ void DrawCircle(const Tizen::Graphics::Point& point, const Tizen::Graphics::Color& color);
+ void Clear(void);
+
+ virtual result OnInitializing(void);
+ virtual result OnDraw(void);
+
+ static const int ELLIPSE_RADIUS = 10;
+
+private:
+ Tizen::Graphics::Canvas* __pCanvas;
+};
+
+#endif /* TOUCHAREAPANEL_H_ */
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#ifndef _UI_GESTURE_DETECTOR_H_
+#define _UI_GESTURE_DETECTOR_H_
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FSystem.h>
+#include <FUi.h>
+
+/**
+ * [UiGestureDetector] UiApp must inherit from UiApp class
+ * which provides basic features necessary to define an UiApp.
+ */
+class UiGestureDetector
+ : public Tizen::App::UiApp
+ , public Tizen::System::IScreenEventListener
+{
+public:
+ static Tizen::App::UiApp* CreateInstance(void);
+
+ UiGestureDetector(void);
+ virtual~UiGestureDetector(void);
+
+ // Called when the UiApp is initializing.
+ virtual bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
+
+ // Called when the UiApp initializing is finished.
+ virtual bool OnAppInitialized(void);
+
+ // Called when the UiApp is requested to terminate.
+ virtual bool OnAppWillTerminate(void);
+
+ // Called when the UiApp is terminating.
+ virtual bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
+
+ // Called when the UiApp's frame moves to the top of the screen.
+ virtual void OnForeground(void);
+
+ // Called when this UiApp's frame is moved from top of the screen to the background.
+ virtual void OnBackground(void);
+
+ // Called when the system memory is not sufficient to run the UiApp any further.
+ virtual void OnLowMemory(void);
+
+ // Called when the battery level changes.
+ virtual void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
+
+ // Called when the screen turns on.
+ virtual void OnScreenOn (void);
+
+ // Called when the screen turns off.
+ virtual void OnScreenOff (void);
+};
+#endif //_UI_GESTURE_DETECTOR_H_
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<Manifest xmlns="http://schemas.tizen.org/2012/12/manifest">
+ <Id>$(manifestAppId)</Id>
+ <Version>1.0.0</Version>
+ <Type>C++App</Type>
+ <Author/>
+ <Descriptions/>
+ <Url/>
+ <DeviceProfile/>
+ <Apps>
+ <Privileges>
+ <Privilege>http://tizen.org/privilege/alarm</Privilege>
+ </Privileges>
+ <ApiVersion>2.0</ApiVersion>
+ <UiApp Main="True" Name="$(projectName)" MenuIconVisible="True" >
+ <DisplayNames>
+ <DisplayName Locale="eng-GB">$(projectName)</DisplayName>
+ </DisplayNames>
+ <UiScalability CoordinateSystem="Logical" BaseScreenSize="Normal" LogicalCoordinate="480" />
+ <UiTheme SystemTheme="White"/>
+ <Icons>
+ <Icon Section="MainMenu" Type="Xhigh">mainmenu.png</Icon>
+ </Icons>
+ <AppControls/>
+ <LaunchConditions/>
+ <Notifications/>
+ </UiApp>
+ </Apps>
+</Manifest>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ This XML file was automatically generated by UiBuilder - do not modify by hand.
+-->
+<!DOCTYPE Scene SYSTEM "UIForm.dtd">
+
+<Scene Bversion="3.0.0.v20120410" Dversion="20120315">
+ <Form id="IDF_UIGESTUREDETECTORFORM">
+ <property backgroundColor="" backgroundOpacity="0" orientation="Automatic" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="FALSE" translucentHeader="FALSE" translucentIndicator="FALSE"/>
+ <layout mode="Portrait" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER" type="LAYOUT_RELATIVE"/>
+ <layout mode="Landscape" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER" type="LAYOUT_RELATIVE"/>
+ </Form>
+ <Footer>
+ <property backgroundBitmapPath="" color="" colorOpacity="0" disabledButtonColor="" disabledButtonColorOpacity="0" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="0" disabledItemTextColor="" footerStyle="FOOTER_STYLE_TAB" highlightedButtonColor="" highlightedButtonColorOpacity="0" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="0" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="0" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="0" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="0" pressedButtonTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor=""/>
+ <itemSet/>
+ </Footer>
+ <Header>
+ <property backgroundBitmapPath="" color="" colorOpacity="0" descriptionText="" descriptionTextColor="" disabledButtonColor="" disabledButtonColorOpacity="0" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="0" disabledItemTextColor="" headerStyle="HEADER_STYLE_TITLE" highlightedButtonColor="" highlightedButtonColorOpacity="0" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="0" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="0" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="0" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="0" pressedButtonTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor="" titleIconPath="" titleText="Hello Tizen!" titleTextColor=""/>
+ <itemSet/>
+ </Header>
+ <Button id="IDC_BUTTON_OK" parent="IDF_UIGESTUREDETECTORFORM">
+ <property DisabledBitmapPath="" NormalBGBitmapPath="" NormalBitmapPath="" PressedBGBitmapPath="" PressedBitmapPath="" disableTextColor="" disabledColor="" disabledColorOpacity="0" horizontalAlign="ALIGN_CENTER" highlightedBGBitmapPath="" highlightedColor="" highlightedColorOpacity="0" highlightedTextColor="" normalColor="" normalColorOpacity="0" normalTextColor="" pressedColor="" pressedColorOpacity="0" pressedTextColor="" text="OK" textSize="32" verticalAlign="ALIGN_MIDDLE"/>
+ <layout bottomRelation="" bottomRelationType="" centerHorizontal="TRUE" centerVertical="TRUE" height="90" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0" marginLeft="0" marginRight="0" marginTop="0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="280"/>
+ <layout bottomRelation="" bottomRelationType="" centerHorizontal="TRUE" centerVertical="TRUE" height="102" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0" marginLeft="0" marginRight="0" marginTop="0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="400"/>
+ </Button>
+</Scene>
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 BaseForm.cpp
+* @brief This is the implementation file for BaseForm class.
+*/
+
+#include "BaseForm.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Media;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Graphics;
+using namespace Tizen::Base;
+using namespace Tizen::Ui::Scenes;
+
+BaseForm::BaseForm(void)
+{
+}
+
+BaseForm::~BaseForm(void)
+{
+}
+
+bool
+BaseForm::SetFooter(void)
+{
+ Footer* pFooter = GetFooter();
+ if (pFooter != null)
+ {
+ pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ pFooter->SetBackButton();
+ }
+
+ return true;
+}
+
+void
+BaseForm::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_EXIT:
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoBackward(BackwardSceneTransition());
+ break;
+ }
+}
+
+result
+BaseForm::OnInitializing(void)
+{
+ SetFormBackEventListener(this);
+
+ return E_SUCCESS;
+}
+
+void
+BaseForm::OnFormBackRequested(Form& source)
+{
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoBackward(BackwardSceneTransition());
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 FormFactory.cpp
+* @brief This is the implementation file for FormFactory class.
+*/
+#include <FUi.h>
+#include <FUiTouchLongPressGestureDetector.h>
+#include <FUiTouchTapGestureDetector.h>
+#include <FUiTouchPinchGestureDetector.h>
+#include <FUiTouchFlickGestureDetector.h>
+#include <FUiTouchPanningGestureDetector.h>
+#include <FUiTouchRotationGestureDetector.h>
+#include "FormFactory.h"
+#include "SampleTapGestureDetectorForm.h"
+#include "SampleLongPressGestureDetectorForm.h"
+#include "SampleFlickGestureDetectorForm.h"
+#include "SamplePinchGestureDetectorForm.h"
+#include "SampleCustomGestureDetectorForm.h"
+#include "SamplePanningGestureDetectorForm.h"
+#include "SampleRotationGestureDetectorForm.h"
+#include "BaseForm.h"
+#include "MainForm.h"
+
+using namespace Tizen::Ui::Controls;
+
+FormFactory::FormFactory()
+{
+ // TODO Auto-generated constructor stub
+}
+
+FormFactory::~FormFactory()
+{
+ // TODO Auto-generated destructor stub
+}
+
+Tizen::Ui::Controls::Form*
+FormFactory::CreateFormN(const Tizen::Base::String &formId, const Tizen::Ui::Scenes::SceneId &sceneId)
+{
+ Form* pNewForm = null;
+ if (formId == L"MainForm")
+ {
+ MainForm* pForm = new (std::nothrow) MainForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ else if (formId == L"SampleLongPressGestureDetectorForm")
+ {
+ SampleLongPressGestureDetectorForm* pForm = new (std::nothrow) SampleLongPressGestureDetectorForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ else if (formId == L"SampleTapGestureDetectorForm")
+ {
+ SampleTapGestureDetectorForm* pForm = new (std::nothrow) SampleTapGestureDetectorForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ else if (formId == L"SampleFlickGestureDetectorForm")
+ {
+ SampleFlickGestureDetectorForm* pForm = new (std::nothrow) SampleFlickGestureDetectorForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ else if (formId == L"SamplePinchGestureDetectorForm")
+ {
+ SamplePinchGestureDetectorForm* pForm = new (std::nothrow) SamplePinchGestureDetectorForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ else if (formId == L"SampleCustomGestureDetectorForm")
+ {
+ SampleCustomGestureDetectorForm* pForm = new (std::nothrow) SampleCustomGestureDetectorForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ else if (formId == L"SampleRotationGestureDetectorForm")
+ {
+ SampleRotationGestureDetectorForm* pForm = new (std::nothrow) SampleRotationGestureDetectorForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ else if (formId == L"SamplePanningGestureDetectorForm")
+ {
+ SamplePanningGestureDetectorForm* pForm = new (std::nothrow) SamplePanningGestureDetectorForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ return pNewForm;
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 MainForm.cpp
+* @brief This is the implementation file for MainForm class.
+*/
+
+#include "MainForm.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Scenes;
+
+MainForm::MainForm(void)
+ : __pHeader(null)
+ , __pListViewMainMenu(null)
+{
+ InitializeListViewMainMenuNameArray();
+}
+
+MainForm::~MainForm(void)
+{
+}
+
+bool
+MainForm::Initialize()
+{
+ result r = E_SUCCESS;
+ r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_INDICATOR);
+
+ return r;
+}
+
+result
+MainForm::OnInitializing(void)
+{
+ InitializeHeader();
+ InitializeListViewMainMenu();
+
+ return E_SUCCESS;
+}
+
+result
+MainForm::OnTerminating(void)
+{
+ return E_SUCCESS;
+}
+
+int
+MainForm::GetItemCount(void)
+{
+ return LIST_VIEW_MAIN_MENU_COUNT;
+}
+
+ListItemBase*
+MainForm::CreateItem (int index, int itemWidth)
+{
+ CustomItem* pCustomItem = new (std::nothrow) CustomItem();
+
+ if (pCustomItem != null)
+ {
+ pCustomItem->Construct(Dimension(itemWidth, 74), LIST_ANNEX_STYLE_NORMAL);
+ pCustomItem->AddElement(Rectangle(17, 21, 480, 50), index, __listViewMainMenuNameArray[index], true);
+ }
+
+ return pCustomItem;
+}
+
+bool
+MainForm::DeleteItem(int index, ListItemBase *pItem, int itemWidth)
+{
+ delete pItem;
+ return true;
+}
+
+void
+MainForm::OnListViewItemStateChanged(ListView &listView, int index, int elementId, ListItemStatus status)
+{
+ if(status == LIST_ITEM_STATUS_SELECTED)
+ {
+ Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
+ if (pFrame == null)
+ {
+ return;
+ }
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ switch (index)
+ {
+ case 0:
+ pSceneManager->GoForward(ForwardSceneTransition(L"SampleLongPressGestureDetectorScene"));
+ break;
+ case 1:
+ pSceneManager->GoForward(ForwardSceneTransition(L"SampleTapGestureDetectorScene"));
+ break;
+ case 2:
+ pSceneManager->GoForward(ForwardSceneTransition(L"SampleFlickGestureDetectorScene"));
+ break;
+ case 3:
+ pSceneManager->GoForward(ForwardSceneTransition(L"SamplePinchGestureDetectorScene"));
+ break;
+ case 4:
+ pSceneManager->GoForward(ForwardSceneTransition(L"SampleCustomGestureDetectorScene"));
+ break;
+ case 5:
+ pSceneManager->GoForward(ForwardSceneTransition(L"SampleRotationGestureDetectorScene"));
+ break;
+ case 6:
+ pSceneManager->GoForward(ForwardSceneTransition(L"SamplePanningGestureDetectorScene"));
+ break;
+ default:
+ return;
+ }
+ return;
+ }
+}
+
+void
+MainForm::OnListViewItemSwept(ListView &listView, int index, SweepDirection direction)
+{
+}
+
+void
+MainForm::OnListViewContextItemStateChanged(ListView &listView, int index, int elementId, ListContextItemStatus state)
+{
+}
+
+void
+MainForm::OnItemReordered(ListView &view, int oldIndex, int newIndex)
+{
+}
+
+void
+MainForm::InitializeListViewMainMenuNameArray(void)
+{
+ __listViewMainMenuNameArray[0] = L"LongPress";
+ __listViewMainMenuNameArray[1] = L"Tap";
+ __listViewMainMenuNameArray[2] = L"Flick";
+ __listViewMainMenuNameArray[3] = L"Pinch";
+ __listViewMainMenuNameArray[4] = L"Custom";
+ __listViewMainMenuNameArray[5] = L"Rotation";
+ __listViewMainMenuNameArray[6] = L"Panning";
+}
+
+void
+MainForm::InitializeHeader(void)
+{
+ __pHeader = GetHeader();
+ if (__pHeader != null)
+ {
+ __pHeader->SetTitleText("UI GESTURE DETECTOR");
+ }
+}
+
+void
+MainForm::InitializeListViewMainMenu(void)
+{
+ __pListViewMainMenu = new (std::nothrow) ListView();
+ if (__pListViewMainMenu != null)
+ {
+ __pListViewMainMenu->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, false);
+ __pListViewMainMenu->SetItemProvider(*this);
+ __pListViewMainMenu->AddListViewItemEventListener(*this);
+ AddControl(*__pListViewMainMenu);
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 SampleCustomGestureDetector.cpp
+* @brief This is the implementation file for SampleCustomGestureDetector class.
+*/
+
+#include "MainForm.h"
+#include "SampleCustomGestureDetector.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+
+const float PI = 3.14159265;
+const float MIN_ANGLE = 30.0;
+const float MAX_ANGLE = 120.0;
+
+SampleCustomGestureDetector::SampleCustomGestureDetector(const Tizen::Graphics::Rectangle &rect)
+ : __previousPoint(0, 0)
+ , __startPoint(0, 0)
+ , __centerPoint(0, 0)
+ , __touchAreaBounds(rect)
+ , __fingerCount(0)
+ , __directionChanged(false)
+{
+
+}
+
+SampleCustomGestureDetector::~SampleCustomGestureDetector(void)
+{
+
+}
+
+void
+SampleCustomGestureDetector::RemoveEventListener(ITouchCustomGestureEventListener& listener)
+{
+ RemoveGestureEventListener(listener);
+}
+
+void
+SampleCustomGestureDetector::AddEventListener(ITouchCustomGestureEventListener& listener)
+{
+ AddGestureEventListener(listener);
+}
+
+void
+SampleCustomGestureDetector::OnTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __fingerCount++;
+
+ if (__fingerCount > 1)
+ {
+ SetDetectorState(GESTURE_DETECTOR_STATE_FAILED);
+ return;
+ }
+
+ __previousPoint.x = touchInfo.GetCurrentPosition().x;
+ __previousPoint.y = touchInfo.GetCurrentPosition().y;
+
+ __directionChanged = false;
+ __startPoint.x = touchInfo.GetCurrentPosition().x;
+ __startPoint.y = touchInfo.GetCurrentPosition().y;
+ SetDetectorState(GESTURE_DETECTOR_STATE_READY);
+}
+
+void
+SampleCustomGestureDetector::OnTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ TouchGestureDetectorState state = GetDetectorState();
+ if (state == GESTURE_DETECTOR_STATE_FAILED)
+ {
+ return;
+ }
+
+ if (touchInfo.GetCurrentPosition().y < 0 || touchInfo.GetCurrentPosition().y > __touchAreaBounds.height)
+ {
+ SetDetectorState(GESTURE_DETECTOR_STATE_FAILED);
+ return;
+ }
+
+ Point currentPoint(touchInfo.GetCurrentPosition().x, touchInfo.GetCurrentPosition().y);
+ if (!__directionChanged && currentPoint.x > __previousPoint.x && currentPoint.y > __previousPoint.y)
+ {
+ __directionChanged = false;
+
+ if (state == GESTURE_DETECTOR_STATE_READY)
+ {
+ SetDetectorState(GESTURE_DETECTOR_STATE_STARTED);
+ }
+ else
+ {
+ SetDetectorState(GESTURE_DETECTOR_STATE_CHANGED);
+ }
+ }
+ else if (state == GESTURE_DETECTOR_STATE_CHANGED)
+ {
+ if (currentPoint.x >= __previousPoint.x && currentPoint.y < __previousPoint.y)
+ {
+ if (!__directionChanged)
+ {
+ __centerPoint.x = __previousPoint.x;
+ __centerPoint.y = __previousPoint.y;
+ }
+
+ __directionChanged = true;
+ SetDetectorState(GESTURE_DETECTOR_STATE_CHANGED);
+ }
+ else
+ {
+ if (__startPoint.x > currentPoint.x)
+ {
+ SetDetectorState(GESTURE_DETECTOR_STATE_FAILED);
+ }
+ }
+ }
+
+ __previousPoint.x = currentPoint.x;
+ __previousPoint.y = currentPoint.y;
+}
+
+void
+SampleCustomGestureDetector::OnTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __fingerCount--;
+
+ if (touchInfo.GetCurrentPosition().y < 0 || touchInfo.GetCurrentPosition().y > __touchAreaBounds.height)
+ {
+ SetDetectorState(GESTURE_DETECTOR_STATE_FAILED);
+ return;
+ }
+
+ Point current(touchInfo.GetCurrentPosition().x, touchInfo.GetCurrentPosition().y);
+ double angle = GetAngle(__centerPoint.x - __startPoint.x, __centerPoint.y - __startPoint.y, __centerPoint.x - current.x, __centerPoint.y - current.y);
+
+ if (GetDetectorState() == GESTURE_DETECTOR_STATE_CHANGED && __directionChanged
+ && angle >= MIN_ANGLE && angle < MAX_ANGLE)
+ {
+ SetDetectorState(GESTURE_DETECTOR_STATE_FINISHED);
+ }
+ else
+ {
+ SetDetectorState(GESTURE_DETECTOR_STATE_FAILED);
+ }
+}
+
+void
+SampleCustomGestureDetector::OnTouchCanceled(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __fingerCount = 0;
+ __directionChanged = false;
+
+ SetDetectorState(GESTURE_DETECTOR_STATE_READY);
+}
+
+double
+SampleCustomGestureDetector::GetAngle(int x1, int y1, int x2, int y2) const
+{
+ return acos( (x1 * x2 + y1 * y2) /
+ (sqrt( x1 * x1 + y1 * y1 ) *
+ sqrt(x2 * x2 + y2 * y2) ) )* 180 / PI;
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 SampleCustomGestureDetectorForm.cpp
+* @brief This is the implementation file for SampleCustomGestureDetectorForm class.
+*/
+
+#include "MainForm.h"
+#include "SampleCustomGestureDetectorForm.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+
+SampleCustomGestureDetectorForm::SampleCustomGestureDetectorForm(void)
+ : __pTouchArea(null)
+ , __pTouchResult(null)
+ , __pClearButton(null)
+{
+}
+
+SampleCustomGestureDetectorForm::~SampleCustomGestureDetectorForm()
+{
+}
+
+bool
+SampleCustomGestureDetectorForm::Initialize(void)
+{
+ Form::Construct(FORM_STYLE_NORMAL| FORM_STYLE_INDICATOR| FORM_STYLE_HEADER| FORM_STYLE_FOOTER);
+ Footer* pFooter = GetFooter();
+ if (pFooter != null)
+ {
+ pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ pFooter->SetBackButton();
+ }
+
+ return true;
+}
+
+result
+SampleCustomGestureDetectorForm::OnInitializing(void)
+{
+ BaseForm::OnInitializing();
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ pHeader->SetTitleText(L"TOUCH CUSTOM GESTURE DETECTOR");
+
+ Rectangle rc;
+ rc = GetClientAreaBounds();
+
+ __pTouchArea = new (std::nothrow) TouchAreaPanel();
+ if (__pTouchArea != null)
+ {
+ __pTouchArea->Initialize(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_MARGIN, rc.width - TOUCH_AREA_MARGIN * 2, TOUCH_AREA_WIDTH));
+ __pTouchArea->SetBackgroundColor(Color::GetColor(COLOR_ID_GREY));
+ AddControl(*__pTouchArea);
+
+ __pCustomGesture = new (std::nothrow) SampleCustomGestureDetector(__pTouchArea->GetBounds());
+ if (__pCustomGesture != null)
+ {
+ __pCustomGesture->Construct();
+ __pTouchArea->AddGestureDetector(*__pCustomGesture);
+ __pCustomGesture->AddEventListener(*this);
+ }
+ }
+
+ Label* pDescription = new (std::nothrow) Label();
+ if (pDescription != null)
+ {
+ pDescription->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_WIDTH, rc.width-TOUCH_AREA_MARGIN*2, DECRIPTION_HEIGHT), L"Touch the screen V shape.");
+ pDescription->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*pDescription);
+ }
+
+ __pTouchResult = new (std::nothrow) Label();
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_RESULT_POS_Y, TOUCH_RESULT_WIDTH, TOUCH_RESULT_HEIGHT), null);
+ __pTouchResult->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTouchResult);
+ }
+
+ __pClearButton = new (std::nothrow) Button();
+ if (__pClearButton != null)
+ {
+ __pClearButton->Construct(Rectangle(CLEAR_BUTTON_POS_X, CLEAR_BUTTON_POS_Y, CLEAR_BUTTON_WIDTH, CLEAR_BUTTON_HEIGHT));
+ __pClearButton->SetActionId(ID_BUTTON_CLEAR);
+ __pClearButton->SetText(L"Clear");
+ __pClearButton->AddActionEventListener(*this);
+ AddControl(*__pClearButton);
+ }
+
+ return r;
+}
+
+Tizen::Ui::Controls::Panel*
+SampleCustomGestureDetectorForm::GetTouchArea(void)
+{
+ return static_cast<Panel*>(__pTouchArea);
+}
+
+void
+SampleCustomGestureDetectorForm::OnCustomGestureStarted(Tizen::Ui::TouchGestureDetector& gestureDetector)
+{
+ Touch touch;
+ Control* pControl = gestureDetector.GetControl();
+ if (pControl != null)
+ {
+ Point currentPosition = touch.GetPosition(*pControl);
+
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L" ");
+ __pTouchResult->Invalidate(false);
+ }
+
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+ }
+}
+
+void
+SampleCustomGestureDetectorForm::OnCustomGestureChanged(Tizen::Ui::TouchGestureDetector& gestureDetector)
+{
+ Touch touch;
+ Control* pControl = gestureDetector.GetControl();
+ if (pControl != null)
+ {
+ Point currentPosition = touch.GetPosition(*pControl);
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+ }
+}
+
+void
+SampleCustomGestureDetectorForm::OnCustomGestureFinished(Tizen::Ui::TouchGestureDetector& gestureDetector)
+{
+ Touch touch;
+ Control* pControl = gestureDetector.GetControl();
+ if (pControl != null)
+ {
+ Point currentPosition = touch.GetPosition(*pControl);
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+ }
+
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Check detected!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SampleCustomGestureDetectorForm::OnCustomGestureCanceled(Tizen::Ui::TouchGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Recognition canceled!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+result
+SampleCustomGestureDetectorForm::OnTerminating(void)
+{
+ if (__pCustomGesture != null)
+ {
+ __pCustomGesture->RemoveEventListener(*this);
+ delete __pCustomGesture;
+ }
+
+ return E_SUCCESS;
+}
+
+void
+SampleCustomGestureDetectorForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_CLEAR:
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L" ");
+ __pTouchResult->Invalidate(false);
+ }
+
+ __pTouchArea->Clear();
+ __pTouchArea->Invalidate(false);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 SampleFlickGestureDetectorForm.cpp
+* @brief This is the implementation file for SampleFlickGestureDetectorForm class.
+*/
+
+#include "MainForm.h"
+#include "SampleFlickGestureDetectorForm.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+
+SampleFlickGestureDetectorForm::SampleFlickGestureDetectorForm(void)
+ : __pTouchArea(null)
+ , __pTouchResult(null)
+ , __pDirectionTitle(null)
+ , __pDirection(null)
+ , __pDistanceTitle(null)
+ , __pDistance(null)
+ , __pFlickGesture(null)
+{
+}
+
+SampleFlickGestureDetectorForm::~SampleFlickGestureDetectorForm()
+{
+}
+
+bool
+SampleFlickGestureDetectorForm::Initialize(void)
+{
+ Construct(FORM_STYLE_NORMAL| FORM_STYLE_INDICATOR| FORM_STYLE_HEADER| FORM_STYLE_FOOTER);
+
+ Footer* pFooter = GetFooter();
+ if (pFooter != null)
+ {
+ pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ pFooter->SetBackButton();
+ }
+
+ return true;
+}
+
+result
+SampleFlickGestureDetectorForm::OnInitializing(void)
+{
+ BaseForm::OnInitializing();
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ if (pHeader != null)
+ {
+ pHeader->SetTitleText(L"TOUCH FLICK GESTURE DETECTOR");
+ }
+
+ Rectangle rc;
+ rc = GetClientAreaBounds();
+
+ __pTouchArea = new (std::nothrow) TouchAreaPanel();
+ if (__pTouchArea != null)
+ {
+ __pTouchArea->Initialize(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_MARGIN, rc.width - TOUCH_AREA_MARGIN * 2, TOUCH_AREA_WIDTH));
+ __pTouchArea->SetBackgroundColor(Color::GetColor(COLOR_ID_GREY));
+ AddControl(*__pTouchArea);
+
+ __pTouchArea->AddTouchEventListener(*this);
+ Touch touch;
+ touch.SetMultipointEnabled(*__pTouchArea, true);
+ }
+
+ __pDirectionTitle = new (std::nothrow) Label();
+ if (__pDirectionTitle != null)
+ {
+ __pDirectionTitle->Construct(Rectangle(TOUCH_AREA_MARGIN, DECRIPTION_POS_Y, TITLE_WIDTH, TITLE_HEIGHT), L"Direction: ");
+ __pDirectionTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDirectionTitle);
+ }
+
+ __pDirection = new (std::nothrow) Label();
+ if (__pDirection != null)
+ {
+ __pDirection->Construct(Rectangle(CONDITION_AREA_POS_X, DECRIPTION_POS_Y, TITLE_WIDTH, TITLE_HEIGHT), null);
+ __pDirection->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDirection);
+ }
+
+ __pDistanceTitle = new (std::nothrow) Label();
+ if (__pDistanceTitle != null)
+ {
+ __pDistanceTitle->Construct(Rectangle(TOUCH_AREA_MARGIN, CONDITION_AREA_POS_Y, TITLE_WIDTH, TITLE_HEIGHT), L"Distance: ");
+ __pDistanceTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDistanceTitle);
+ }
+
+ __pDistance = new (std::nothrow) Label();
+ if (__pDistance != null)
+ {
+ __pDistance->Construct(Rectangle(CONDITION_AREA_POS_X, CONDITION_AREA_POS_Y, TITLE_WIDTH, TITLE_HEIGHT), null);
+ __pDistance->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDistance);
+ }
+
+ __pTouchResult = new (std::nothrow) Label();
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_RESULT_POS_Y, TOUCH_RESULT_WIDTH, TITLE_HEIGHT), null);
+ __pTouchResult->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTouchResult);
+ }
+
+ __pClearButton = new (std::nothrow) Button();
+ if (__pClearButton != null)
+ {
+ __pClearButton->Construct(Rectangle(CLEAR_BUTTON_POS_X, CLEAR_BUTTON_POS_Y, CLEAR_BUTTON_WIDTH, CLEAR_BUTTON_HEIGHT));
+ __pClearButton->SetActionId(ID_BUTTON_CLEAR);
+ __pClearButton->SetText(L"Clear");
+ __pClearButton->AddActionEventListener(*this);
+ AddControl(*__pClearButton);
+ }
+
+ __pFlickGesture = new (std::nothrow) TouchFlickGestureDetector;
+ if (__pFlickGesture != null)
+ {
+ __pFlickGesture->Construct();
+ __pTouchArea->AddGestureDetector(*__pFlickGesture);
+ __pFlickGesture->AddFlickGestureEventListener(*this);
+ }
+
+ return r;
+}
+
+void
+SampleFlickGestureDetectorForm::OnTouchMoved(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
+{
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SampleFlickGestureDetectorForm::OnTouchPressed(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
+{
+ __pTouchResult->SetText(L"");
+ __pTouchResult->Invalidate(false);
+
+ __pDirection->SetText(L"");
+ __pDirection->Invalidate(false);
+
+ __pDistance->SetText(L"");
+ __pDistance->Invalidate(false);
+
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SampleFlickGestureDetectorForm::OnTouchReleased(const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
+{
+}
+
+void
+SampleFlickGestureDetectorForm::OnTouchFocusIn (const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
+{
+}
+
+void
+SampleFlickGestureDetectorForm::OnTouchFocusOut (const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo)
+{
+}
+
+void
+SampleFlickGestureDetectorForm::OnFlickGestureDetected(TouchFlickGestureDetector& gestureDetector)
+{
+ Rectangle rc(0, 0, 0, 0);
+ Point point(0, 0);
+
+ if (__pTouchArea != null)
+ {
+ rc = __pTouchArea->GetBounds();
+
+ Touch touch;
+ point = touch.GetPosition(*__pTouchArea);
+ }
+
+ if (point.y < 0 || point.y > rc.height)
+ {
+ return;
+ }
+
+ __pTouchArea->DrawCircle(point, Color::GetColor(COLOR_ID_RED));
+ __pTouchArea->Invalidate(false);
+
+ FlickDirection direction = gestureDetector.GetDirection();
+ String string;
+ switch(direction)
+ {
+ case FLICK_DIRECTION_RIGHT:
+ string = L"RIGHT";
+ break;
+
+ case FLICK_DIRECTION_LEFT:
+ string = L"LEFT";
+ break;
+
+ case FLICK_DIRECTION_UP:
+ string = L"UP";
+ break;
+
+ case FLICK_DIRECTION_DOWN:
+ string = L"DOWN";
+ break;
+
+ case FLICK_DIRECTION_NONE:
+ default:
+ string = L"NONE";
+ break;
+ }
+
+ if (__pDirection != null)
+ {
+ __pDirection->SetText(string);
+ __pDirection->Invalidate(false);
+ }
+
+ Point distance(0, 0);
+ gestureDetector.GetDistance(distance.x, distance.y);
+
+ if (direction == FLICK_DIRECTION_LEFT || direction == FLICK_DIRECTION_RIGHT)
+ {
+ string = Integer::ToString(distance.x);
+ }
+ else if (direction == FLICK_DIRECTION_DOWN || direction == FLICK_DIRECTION_UP)
+ {
+ string = Integer::ToString(distance.y);
+ }
+ else
+ {
+ string = L"";
+ }
+
+ if (__pDistance != null)
+ {
+ __pDistance->SetText(string);
+ __pDistance->Invalidate(false);
+ }
+
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Flick detected!");
+ __pTouchResult->Invalidate(false);
+ }
+
+ Invalidate(false);
+}
+
+void
+SampleFlickGestureDetectorForm::OnFlickGestureCanceled(TouchFlickGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Flick canceled!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+result
+SampleFlickGestureDetectorForm::OnTerminating(void)
+{
+ if (__pFlickGesture != null)
+ {
+ __pFlickGesture->RemoveFlickGestureEventListener(*this);
+ delete __pFlickGesture;
+ }
+
+ return E_SUCCESS;
+}
+
+void
+SampleFlickGestureDetectorForm::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_CLEAR:
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L" ");
+ __pTouchResult->Invalidate(false);
+ }
+
+ if (__pDirection != null)
+ {
+ __pDirection->SetText(L" ");
+ __pDirection->Invalidate(false);
+ }
+
+ if (__pDistance != null)
+ {
+ __pDistance->SetText(L" ");
+ __pDistance->Invalidate(false);
+ }
+
+ __pTouchArea->Clear();
+ __pTouchArea->Invalidate(false);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 SampleLongPressGestureDetectorForm.cpp
+* @brief This is the implementation file for SampleLongPressGestureDetectorForm class.
+*/
+
+#include "MainForm.h"
+#include "SampleLongPressGestureDetectorForm.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+
+SampleLongPressGestureDetectorForm::SampleLongPressGestureDetectorForm(void)
+ : __pDurationLabel(null)
+ , __pFingerCountLabel(null)
+ , __pDuration(null)
+ , __pFingerCount(null)
+ , __pTouchArea(null)
+ , __pTouchResult(null)
+ , __pClearButton(null)
+ , __pLongPressGesture(null)
+ , __previousDuration(0)
+ , __previousTouchCount(0)
+{
+}
+
+SampleLongPressGestureDetectorForm::~SampleLongPressGestureDetectorForm()
+{
+}
+
+bool
+SampleLongPressGestureDetectorForm::Initialize(void)
+{
+ Construct(FORM_STYLE_NORMAL| FORM_STYLE_INDICATOR| FORM_STYLE_HEADER| FORM_STYLE_FOOTER);
+
+ Footer* pFooter = GetFooter();
+ if (pFooter != null)
+ {
+ pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ pFooter->SetBackButton();
+ }
+
+ return true;
+}
+
+result
+SampleLongPressGestureDetectorForm::OnInitializing(void)
+{
+ BaseForm::OnInitializing();
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ if (pHeader != null)
+ {
+ pHeader->SetTitleText(L"TOUCH LONG PRESS GESTURE DETECTOR");
+ }
+
+ Rectangle rc;
+ rc = GetClientAreaBounds();
+
+ __pDurationLabel = new (std::nothrow) Label();
+ if (__pDurationLabel != null)
+ {
+ __pDurationLabel->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_MARGIN, CONDITION_WIDTH, CONDITION_HEIGHT), L"Duration : ");
+ __pDurationLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDurationLabel);
+ }
+
+ __pDuration = new (std::nothrow) EditField();
+ if (__pDuration != null)
+ {
+ __pDuration->Construct(Rectangle(CONDITION_POS_X, TOUCH_AREA_MARGIN, CONDITION_WIDTH, CONDITION_HEIGHT), EDIT_FIELD_STYLE_NUMBER_SMALL, INPUT_STYLE_FULLSCREEN, false, DURATION_MAX);
+ __pDuration->AddTextEventListener(*this);
+ __pDuration->SetText(L"500");
+ AddControl(*__pDuration);
+ }
+
+ __pFingerCountLabel = new (std::nothrow) Label();
+ if (__pFingerCountLabel != null)
+ {
+ __pFingerCountLabel->Construct(Rectangle(TOUCH_AREA_MARGIN, CONDITION_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), L"Finger Count : ");
+ __pFingerCountLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pFingerCountLabel);
+ }
+
+ __pFingerCount = new (std::nothrow) EditField();
+ if (__pFingerCount != null)
+ {
+ __pFingerCount->Construct(Rectangle(CONDITION_POS_X, CONDITION_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), EDIT_FIELD_STYLE_NUMBER_SMALL, INPUT_STYLE_FULLSCREEN, false, TOUCH_COUNT_MAX);
+ __pFingerCount->AddTextEventListener(*this);
+ __pFingerCount->SetText(L"1");
+ AddControl(*__pFingerCount);
+ }
+
+ __pTouchArea = new (std::nothrow) TouchAreaPanel();
+ if (__pTouchArea != null)
+ {
+ __pTouchArea->Initialize(Rectangle(TOUCH_AREA_MARGIN, CANVAS_POS_Y, rc.width - TOUCH_AREA_MARGIN * 2, CANVAS_HEIGHT));
+ __pTouchArea->SetBackgroundColor(Color::GetColor(COLOR_ID_GREY));
+ AddControl(*__pTouchArea);
+
+ __pTouchArea->AddTouchEventListener(*this);
+ Touch touch;
+ touch.SetMultipointEnabled(*__pTouchArea, true);
+ }
+
+ __pTouchResult = new (std::nothrow) Label();
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_POS_Y, TOUCH_RESULT_WIDTH, TOUCH_RESULT_HEIGHT), null);
+ __pTouchResult->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTouchResult);
+ }
+
+ __pClearButton = new (std::nothrow) Button();
+ if (__pClearButton != null)
+ {
+ __pClearButton->Construct(Rectangle(CLEAR_BUTTON_POS_X, CLEAR_BUTTON_POS_Y, CLEAR_BUTTON_WIDTH, CLEAR_BUTTON_HEIGHT));
+ __pClearButton->SetActionId(ID_BUTTON_CLEAR);
+ __pClearButton->SetText(L"Clear");
+ __pClearButton->AddActionEventListener(*this);
+ AddControl(*__pClearButton);
+ }
+
+ __pLongPressGesture = new (std::nothrow) TouchLongPressGestureDetector;
+ if (__pLongPressGesture != null)
+ {
+ __pLongPressGesture->Construct();
+ __pTouchArea->AddGestureDetector(*__pLongPressGesture);
+ __pLongPressGesture->AddLongPressGestureEventListener(*this);
+ __previousDuration = __pLongPressGesture->GetDuration();
+ __previousTouchCount = __pLongPressGesture->GetTouchCount();
+ }
+
+ return r;
+}
+
+void
+SampleLongPressGestureDetectorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SampleLongPressGestureDetectorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchResult->SetText(L"");
+ __pTouchResult->Invalidate(false);
+
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SampleLongPressGestureDetectorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SampleLongPressGestureDetectorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SampleLongPressGestureDetectorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SampleLongPressGestureDetectorForm::OnLongPressGestureDetected(TouchLongPressGestureDetector& gestureDetector)
+{
+ Rectangle rc(0, 0, 0, 0);
+ Point point(0, 0);
+
+ if (__pTouchArea != null)
+ {
+ rc = __pTouchArea->GetBounds();
+
+ Touch touch;
+ int fingerCount = 0;
+ Tizen::Base::Integer::Decode(__pFingerCount->GetText(), fingerCount);
+ for(int i=0; i < fingerCount; i++)
+ {
+ point = touch.GetPosition(*__pTouchArea, i);
+
+ if (point.y < 0 || point.y > rc.height)
+ {
+ return;
+ }
+ __pTouchArea->DrawCircle(point, Color::GetColor(COLOR_ID_RED));
+ }
+ __pTouchArea->Invalidate(false);
+ }
+
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"LongPress detected!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SampleLongPressGestureDetectorForm::OnLongPressGestureCanceled(TouchLongPressGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"LongPress canceled!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SampleLongPressGestureDetectorForm::OnTextValueChanged(const Control& source)
+{
+ EditField* pEditfield = dynamic_cast<EditField*>(const_cast<Control*>(&source));
+ result r = E_SUCCESS;
+
+ if (pEditfield != null)
+ {
+ if (pEditfield == __pDuration)
+ {
+ __previousDuration = __pLongPressGesture->GetDuration();
+
+ Tizen::Base::String string = pEditfield->GetText();
+ int duration = 0;
+ Tizen::Base::Integer::Decode(string, duration);
+ const wchar_t* pChars = string.GetPointer();
+ bool isDigit = true;
+ for(int i=0; i< string.GetLength(); i++)
+ {
+ isDigit = Tizen::Base::Character::IsDigit(*(pChars+i));
+ if (!isDigit)
+ {
+ break;
+ }
+ }
+
+ if (!isDigit)
+ {
+ __pTouchResult->SetText(L"Input only numbers!");
+ __pDuration->SetText(Tizen::Base::Integer::ToString(__previousDuration));
+ __pLongPressGesture->SetDuration(__previousDuration);
+ }
+ else
+ {
+ if (duration > 100000)
+ {
+ __pTouchResult->SetText(L"The duration should be below 100000.");
+ __pDuration->SetText(L"100000");
+ __pLongPressGesture->SetDuration(100000);
+ }
+ else
+ {
+ r = __pLongPressGesture->SetDuration(duration);
+ if (r != E_SUCCESS)
+ {
+ __pTouchResult->SetText(L"The duration should be over 1.");
+ __pDuration->SetText(Tizen::Base::Integer::ToString(__previousDuration));
+ }
+ else
+ {
+ __pTouchResult->SetText(L"");
+ }
+ }
+ }
+ }
+ else if (pEditfield == __pFingerCount)
+ {
+ __previousTouchCount = __pLongPressGesture->GetTouchCount();
+
+ Tizen::Base::String string = pEditfield->GetText();
+ int count = 0;
+ Tizen::Base::Integer::Decode(string, count);
+
+ const wchar_t* pChars = string.GetPointer();
+ bool isDigit = true;
+ for(int i=0; i< string.GetLength(); i++)
+ {
+ isDigit = Tizen::Base::Character::IsDigit(*(pChars+i));
+ if (!isDigit)
+ {
+ break;
+ }
+ }
+
+ if (!isDigit)
+ {
+ __pTouchResult->SetText(L"Input only numbers!");
+ __pFingerCount->SetText(Tizen::Base::Integer::ToString(__previousTouchCount));
+ __pLongPressGesture->SetTouchCount(__previousTouchCount);
+ }
+ else
+ {
+ int maxTouchPoints = 0;
+ result r = Tizen::System::SystemInfo::GetValue(L"MultiPointTouchCount", maxTouchPoints);
+ if (r == E_SUCCESS)
+ {
+ if (count > maxTouchPoints)
+ {
+ Tizen::Base::String output = L"The touch count should below ";
+ __pTouchResult->SetText(output+Tizen::Base::Integer::ToString(maxTouchPoints));
+ __pFingerCount->SetText(Tizen::Base::Integer::ToString(maxTouchPoints));
+ __pLongPressGesture->SetTouchCount(maxTouchPoints);
+ }
+ else
+ {
+ r = __pLongPressGesture->SetTouchCount(count);
+ if (r != E_SUCCESS)
+ {
+ __pTouchResult->SetText(L"The touch count should be over 1.");
+ __pFingerCount->SetText(Tizen::Base::Integer::ToString(__previousTouchCount));
+ }
+ else
+ {
+ __pTouchResult->SetText(L"");
+ }
+ }
+ }
+ }
+ }
+ __pTouchResult->Invalidate(false);
+ }
+ SetFocus();
+}
+
+void
+SampleLongPressGestureDetectorForm::OnTextValueChangeCanceled(const Control& source)
+{
+ SetFocus();
+}
+
+result
+SampleLongPressGestureDetectorForm::OnTerminating(void)
+{
+ if (__pLongPressGesture != null)
+ {
+ __pLongPressGesture->RemoveLongPressGestureEventListener(*this);
+ delete __pLongPressGesture;
+ }
+
+ return E_SUCCESS;
+}
+
+void
+SampleLongPressGestureDetectorForm::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_CLEAR:
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L" ");
+ __pTouchResult->Invalidate(false);
+ }
+
+ __pTouchArea->Clear();
+ __pTouchArea->Invalidate(false);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 SamplePanningGestureDetectorForm.cpp
+* @brief This is the implementation file for SamplePanningGestureDetectorForm class.
+*/
+
+#include "MainForm.h"
+#include "SamplePanningGestureDetectorForm.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Base::Collection;
+
+SamplePanningGestureDetectorForm::SamplePanningGestureDetectorForm(void)
+ : __pTouchArea(null)
+ , __pTouchResult(null)
+ , __pTouchCountTitle(null)
+ , __pTouchCount(null)
+ , __pClearButton(null)
+ , __pPanningGesture(null)
+ , __previousTouchCount(0)
+{
+}
+
+SamplePanningGestureDetectorForm::~SamplePanningGestureDetectorForm()
+{
+}
+
+bool
+SamplePanningGestureDetectorForm::Initialize(void)
+{
+ Construct(FORM_STYLE_NORMAL| FORM_STYLE_INDICATOR| FORM_STYLE_HEADER| FORM_STYLE_FOOTER);
+
+ Footer* pFooter = GetFooter();
+ if (pFooter != null)
+ {
+ pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ pFooter->SetBackButton();
+ }
+
+ return true;
+}
+
+result
+SamplePanningGestureDetectorForm::OnInitializing(void)
+{
+ BaseForm::OnInitializing();
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ if (pHeader != null)
+ {
+ pHeader->SetTitleText(L"TOUCH PANNING GESTURE DETECTOR");
+ }
+
+ Rectangle rc;
+ rc = GetClientAreaBounds();
+
+ __pTouchCountTitle = new (std::nothrow) Label();
+ if (__pTouchCountTitle != null)
+ {
+ __pTouchCountTitle->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_MARGIN, CONDITION_WIDTH, CONDITION_HEIGHT), L"Touch Count : ");
+ __pTouchCountTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTouchCountTitle);
+ }
+
+ __pTouchCount = new (std::nothrow) EditField();
+ if (__pTouchCount != null)
+ {
+ __pTouchCount->Construct(Rectangle(CONDITION_POS_X, TOUCH_AREA_MARGIN, CONDITION_WIDTH, CONDITION_HEIGHT), EDIT_FIELD_STYLE_NUMBER_SMALL, INPUT_STYLE_FULLSCREEN, false, TOUCH_COUNT_MAX);
+ __pTouchCount->AddTextEventListener(*this);
+ __pTouchCount->SetText(L"1");
+ AddControl(*__pTouchCount);
+ }
+
+ __pTouchArea = new (std::nothrow) TouchAreaPanel();
+ if (__pTouchArea != null)
+ {
+ __pTouchArea->Initialize(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_POS_Y, rc.width - TOUCH_AREA_MARGIN * 2, TOUCH_AREA_WIDTH));
+ __pTouchArea->SetBackgroundColor(Color::GetColor(COLOR_ID_GREY));
+ AddControl(*__pTouchArea);
+
+ __pTouchArea->AddTouchEventListener(*this);
+ Touch touch;
+ touch.SetMultipointEnabled(*__pTouchArea, true);
+ }
+
+ __pTouchResult = new (std::nothrow) Label();
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_RESULT_POS_Y, TOUCH_RESULT_WIDTH, TOUCH_RESULT_HEIGHT), null);
+ __pTouchResult->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTouchResult);
+ }
+
+ __pClearButton = new (std::nothrow) Button();
+ if (__pClearButton != null)
+ {
+ __pClearButton->Construct(Rectangle(CLEAR_BUTTON_POS_X, CLEAR_BUTTON_POS_Y, CLEAR_BUTTON_WIDTH, CLEAR_BUTTON_HEIGHT));
+ __pClearButton->SetActionId(ID_BUTTON_CLEAR);
+ __pClearButton->SetText(L"Clear");
+ __pClearButton->AddActionEventListener(*this);
+ AddControl(*__pClearButton);
+ }
+
+ __pPanningGesture = new (std::nothrow) TouchPanningGestureDetector;
+ if (__pPanningGesture != null)
+ {
+ __pPanningGesture->Construct();
+ __pTouchArea->AddGestureDetector(*__pPanningGesture);
+ __pPanningGesture->AddPanningGestureEventListener(*this);
+ __previousTouchCount = __pPanningGesture->GetTouchCount();
+ }
+
+ return r;
+}
+
+void
+SamplePanningGestureDetectorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SamplePanningGestureDetectorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchResult->SetText(L"");
+ __pTouchResult->Invalidate(false);
+
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SamplePanningGestureDetectorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SamplePanningGestureDetectorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SamplePanningGestureDetectorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SamplePanningGestureDetectorForm::OnTextValueChanged(const Control& source)
+{
+ EditField* pEditfield = dynamic_cast<EditField*>(const_cast<Control*>(&source));
+ if (pEditfield != null)
+ {
+ __previousTouchCount = __pPanningGesture->GetTouchCount();
+
+ Tizen::Base::String string = pEditfield->GetText();
+ int count = 0;
+ Tizen::Base::Integer::Decode(string, count);
+
+ int maxTouchPoints = 0;
+ result r = Tizen::System::SystemInfo::GetValue(L"MultiPointTouchCount", maxTouchPoints);
+ if (r == E_SUCCESS)
+ {
+ if (count > maxTouchPoints)
+ {
+ Tizen::Base::String output = L"The touch count should be below ";
+ __pTouchResult->SetText(output+Tizen::Base::Integer::ToString(maxTouchPoints));
+ __pTouchCount->SetText(Tizen::Base::Integer::ToString(maxTouchPoints));
+ __pPanningGesture->SetTouchCount(maxTouchPoints);
+ }
+ else
+ {
+ r = __pPanningGesture->SetTouchCount(count);
+ if (r != E_SUCCESS)
+ {
+ __pTouchResult->SetText(L"The touch count should be over 1.");
+ __pTouchCount->SetText(Tizen::Base::Integer::ToString(__previousTouchCount));
+ }
+ else
+ {
+ __pTouchResult->SetText(L"");
+ __pTouchCount->SetText(Tizen::Base::Integer::ToString(count));
+ }
+ }
+ }
+ __pTouchResult->Invalidate(false);
+ }
+
+ SetFocus();
+}
+
+void
+SamplePanningGestureDetectorForm::OnTextValueChangeCanceled(const Control& source)
+{
+ SetFocus();
+}
+
+void
+SamplePanningGestureDetectorForm::OnPanningGestureStarted(TouchPanningGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Panning started!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SamplePanningGestureDetectorForm::OnPanningGestureChanged(TouchPanningGestureDetector& gestureDetector)
+{
+ Rectangle rc(0, 0, 0, 0);
+ Point point(0, 0);
+
+ if (__pTouchArea != null)
+ {
+ rc = __pTouchArea->GetBounds();
+
+ Touch touch;
+ int fingerCount = 0;
+ Tizen::Base::Integer::Decode(__pTouchCount->GetText(), fingerCount);
+ for(int i=0; i < fingerCount; i++)
+ {
+ point = touch.GetPosition(*__pTouchArea, i);
+
+ if (point.y < 0 || point.y > rc.height)
+ {
+ return;
+ }
+ }
+ }
+
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Panning changed!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SamplePanningGestureDetectorForm::OnPanningGestureFinished(TouchPanningGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Panning finished!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SamplePanningGestureDetectorForm::OnPanningGestureCanceled(TouchPanningGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Tap canceled!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+result
+SamplePanningGestureDetectorForm::OnTerminating(void)
+{
+ if (__pPanningGesture != null)
+ {
+ __pPanningGesture->RemovePanningGestureEventListener(*this);
+ delete __pPanningGesture;
+ }
+
+ return E_SUCCESS;
+}
+
+void
+SamplePanningGestureDetectorForm::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_CLEAR:
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L" ");
+ __pTouchResult->Invalidate(false);
+ }
+
+ __pTouchArea->Clear();
+ __pTouchArea->Invalidate(false);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 SamplePinchGestureDetectorForm.cpp
+* @brief This is the implementation file for SamplePinchGestureDetectorForm class.
+*/
+
+#include "MainForm.h"
+#include "SamplePinchGestureDetectorForm.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+using namespace Tizen::Base;
+
+SamplePinchGestureDetectorForm::SamplePinchGestureDetectorForm(void)
+ : __pTouchArea(null)
+ , __pTouchResult(null)
+ , __pClearButton(null)
+ , __pScaleTitle(null)
+ , __pScale(null)
+ , __pCenterPositionXTitle(null)
+ , __pCenterPositionYTitle(null)
+ , __pCenterPositionX(null)
+ , __pCenterPositionY(null)
+ , __pPinchGesture(null)
+{
+}
+
+SamplePinchGestureDetectorForm::~SamplePinchGestureDetectorForm()
+{
+}
+
+bool
+SamplePinchGestureDetectorForm::Initialize(void)
+{
+ Construct(FORM_STYLE_NORMAL| FORM_STYLE_INDICATOR| FORM_STYLE_HEADER| FORM_STYLE_FOOTER);
+
+ Footer* pFooter = GetFooter();
+ if (pFooter != null)
+ {
+ pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ pFooter->SetBackButton();
+ }
+
+ return true;
+}
+
+result
+SamplePinchGestureDetectorForm::OnInitializing(void)
+{
+ BaseForm::OnInitializing();
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ if (pHeader != null)
+ {
+ pHeader->SetTitleText(L"TOUCH PINCH GESTURE DETECTOR");
+ }
+
+ Rectangle rc;
+ rc = GetClientAreaBounds();
+
+ __pTouchArea = new (std::nothrow) TouchAreaPanel();
+ if (__pTouchArea != null)
+ {
+ __pTouchArea->Initialize(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_MARGIN, rc.width - TOUCH_AREA_MARGIN * 2, TOUCH_AREA_WIDTH));
+ __pTouchArea->SetBackgroundColor(Color::GetColor(COLOR_ID_GREY));
+ AddControl(*__pTouchArea);
+
+ __pTouchArea->AddTouchEventListener(*this);
+ Touch touch;
+ touch.SetMultipointEnabled(*__pTouchArea, true);
+ }
+
+ __pScaleTitle = new (std::nothrow) Label();
+ if (__pScaleTitle != null)
+ {
+ __pScaleTitle->Construct(Rectangle(TOUCH_AREA_MARGIN, SCALE_RESULT_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), L"Scale: ");
+ __pScaleTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pScaleTitle);
+ }
+
+ __pScale = new (std::nothrow) Label();
+ if (__pScale != null)
+ {
+ __pScale->Construct(Rectangle(SCALE_RESULT_POS_X, SCALE_RESULT_POS_Y, CONDITION_WIDTH, 50), null);
+ __pScale->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pScale);
+ }
+
+ __pCenterPositionXTitle = new (std::nothrow) Label();
+ if (__pCenterPositionXTitle != null)
+ {
+ __pCenterPositionXTitle->Construct(Rectangle(TOUCH_AREA_MARGIN, CENTERX_RESULT_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), L"CenterPositionX: ");
+ __pCenterPositionXTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pCenterPositionXTitle);
+ }
+
+ __pCenterPositionX = new (std::nothrow) Label();
+ if (__pCenterPositionX != null)
+ {
+ __pCenterPositionX->Construct(Rectangle(CENTER_RESULT_POS_X, CENTERX_RESULT_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), null);
+ __pCenterPositionX->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pCenterPositionX);
+ }
+
+ __pCenterPositionYTitle = new (std::nothrow) Label();
+ if (__pCenterPositionYTitle != null)
+ {
+ __pCenterPositionYTitle->Construct(Rectangle(TOUCH_AREA_MARGIN, CENTERY_RESULT_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), L"CenterPositionY: ");
+ __pCenterPositionYTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pCenterPositionYTitle);
+ }
+
+ __pCenterPositionY = new (std::nothrow) Label();
+ if (__pCenterPositionY != null)
+ {
+ __pCenterPositionY->Construct(Rectangle(CENTER_RESULT_POS_X, CENTERY_RESULT_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), null);
+ __pCenterPositionY->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pCenterPositionY);
+ }
+
+ __pTouchResult = new (std::nothrow) Label();
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_RESULT_POS_Y, TOUCH_RESULT_WIDTH, CONDITION_HEIGHT), null);
+ __pTouchResult->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTouchResult);
+ }
+
+ __pClearButton = new (std::nothrow) Button();
+ if (__pClearButton != null)
+ {
+ __pClearButton->Construct(Rectangle(CLEAR_BUTTON_POS_X, CLEAR_BUTTON_POS_Y, CLEAR_BUTTON_WIDTH, CLEAR_BUTTON_HEIGHT));
+ __pClearButton->SetActionId(ID_BUTTON_CLEAR);
+ __pClearButton->SetText(L"Clear");
+ __pClearButton->AddActionEventListener(*this);
+ AddControl(*__pClearButton);
+ }
+
+ __pPinchGesture = new (std::nothrow) TouchPinchGestureDetector;
+ if (__pPinchGesture != null)
+ {
+ __pPinchGesture->Construct();
+ __pTouchArea->AddGestureDetector(*__pPinchGesture);
+ __pPinchGesture->AddPinchGestureEventListener(*this);
+ }
+
+ return r;
+}
+
+void
+SamplePinchGestureDetectorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SamplePinchGestureDetectorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+
+ if(touchInfo.GetPointId() == 0)
+ {
+ __pTouchResult->SetText(L"");
+ __pTouchResult->Invalidate(false);
+
+ __pScale->SetText(L"");
+ __pScale->Invalidate(false);
+
+ __pCenterPositionX->SetText(L"");
+ __pCenterPositionX->Invalidate(false);
+
+ __pCenterPositionY->SetText(L"");
+ __pCenterPositionY->Invalidate(false);
+ }
+
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SamplePinchGestureDetectorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SamplePinchGestureDetectorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SamplePinchGestureDetectorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SamplePinchGestureDetectorForm::OnPinchGestureStarted(TouchPinchGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Pinch Started!");
+ __pTouchResult->Invalidate(false);
+ }
+
+ DisplayInformation(gestureDetector);
+}
+
+void
+SamplePinchGestureDetectorForm::OnPinchGestureChanged(TouchPinchGestureDetector& gestureDetector)
+{
+ Rectangle rc(0, 0, 0, 0);
+ Point firstPoint(0, 0);
+ Point secondPoint(0, 0);
+
+ if (__pTouchArea != null)
+ {
+ rc = __pTouchArea->GetBounds();
+
+ Touch touch;
+ Control* pControl = gestureDetector.GetControl();
+ if (pControl != null)
+ {
+ Tizen::Base::Collection::IList* pList = touch.GetTouchInfoListN(*pControl);
+
+ if (pList != null)
+ {
+ TouchInfo *pFirstTouchInfo = static_cast<TouchInfo *>(pList->GetAt(0));
+ if (pFirstTouchInfo != null)
+ {
+ firstPoint.x = pFirstTouchInfo->position.x;
+ firstPoint.y = pFirstTouchInfo->position.y;
+ }
+
+ TouchInfo *pSecondTouchInfo = static_cast<TouchInfo *>(pList->GetAt(1));
+ if (pSecondTouchInfo != null)
+ {
+ secondPoint.x = pSecondTouchInfo->position.x;
+ secondPoint.y = pSecondTouchInfo->position.y;
+ }
+ }
+ }
+ }
+
+ if (firstPoint.y >= 0 && firstPoint.y <= rc.height
+ && secondPoint.y >= 0 && secondPoint.y <= rc.height)
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Pinch Changed!");
+ __pTouchResult->Invalidate(false);
+ }
+
+ DisplayInformation(gestureDetector);
+ }
+}
+
+void
+SamplePinchGestureDetectorForm::OnPinchGestureFinished(TouchPinchGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Pinch Finished!");
+ __pTouchResult->Invalidate(false);
+ }
+
+ DisplayInformation(gestureDetector);
+}
+
+void
+SamplePinchGestureDetectorForm::OnPinchGestureCanceled(TouchPinchGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Pinch canceled!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SamplePinchGestureDetectorForm::DisplayInformation(TouchPinchGestureDetector& gestureDetector)
+{
+ Tizen::Base::String centerX = Tizen::Base::Integer::ToString(gestureDetector.GetCenterPoint().x);
+ Tizen::Base::String centerY = Tizen::Base::Integer::ToString(gestureDetector.GetCenterPoint().y);
+ Tizen::Base::String scale = Tizen::Base::Integer::ToString(gestureDetector.GetScale());
+
+ if (__pScale != null)
+ {
+ __pScale->SetText(scale);
+ __pScale->Invalidate(false);
+ }
+
+ if (__pCenterPositionX != null)
+ {
+ __pCenterPositionX->SetText(centerX);
+ __pCenterPositionX->Invalidate(false);
+ }
+
+ if (__pCenterPositionY != null)
+ {
+ __pCenterPositionY->SetText(centerY);
+ __pCenterPositionY->Invalidate(false);
+ }
+}
+
+
+result
+SamplePinchGestureDetectorForm::OnTerminating(void)
+{
+ if (__pPinchGesture != null)
+ {
+ __pPinchGesture->RemovePinchGestureEventListener(*this);
+ delete __pPinchGesture;
+ }
+
+ return E_SUCCESS;
+}
+
+void
+SamplePinchGestureDetectorForm::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_CLEAR:
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L" ");
+ __pTouchResult->Invalidate(false);
+ }
+
+ if (__pScale != null)
+ {
+ __pScale->SetText(L" ");
+ __pScale->Invalidate(false);
+ }
+
+ if (__pCenterPositionX != null)
+ {
+ __pCenterPositionX->SetText(L" ");
+ __pCenterPositionX->Invalidate(false);
+ }
+
+ if (__pCenterPositionY != null)
+ {
+ __pCenterPositionY->SetText(L" ");
+ __pCenterPositionY->Invalidate(false);
+ }
+
+ __pTouchArea->Clear();
+ __pTouchArea->Invalidate(false);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 SampleRotationGestureDetectorForm.cpp
+* @brief This is the implementation file for SampleRotationGestureDetectorForm class.
+*/
+
+#include "MainForm.h"
+#include "SampleRotationGestureDetectorForm.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+
+SampleRotationGestureDetectorForm::SampleRotationGestureDetectorForm(void)
+ : __pTouchResult(null)
+ , __pDistanceTitle(null)
+ , __pAngleTitle(null)
+ , __pDistance(null)
+ , __pAngle(null)
+ , __pRotationGesture(null)
+ , __pTouchArea(null)
+{
+}
+
+SampleRotationGestureDetectorForm::~SampleRotationGestureDetectorForm()
+{
+}
+
+bool
+SampleRotationGestureDetectorForm::Initialize(void)
+{
+ Construct(FORM_STYLE_NORMAL| FORM_STYLE_INDICATOR| FORM_STYLE_HEADER| FORM_STYLE_FOOTER);
+
+ Footer* pFooter = GetFooter();
+ if (pFooter != null)
+ {
+ pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ pFooter->SetBackButton();
+ }
+
+ return true;
+}
+
+result
+SampleRotationGestureDetectorForm::OnInitializing(void)
+{
+ BaseForm::OnInitializing();
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ if (pHeader != null)
+ {
+ pHeader->SetTitleText(L"TOUCH ROTATION GESTURE DETECTOR");
+ }
+
+ Rectangle rc;
+ rc = GetClientAreaBounds();
+
+ __pTouchArea = new (std::nothrow) TouchAreaPanel();
+ if (__pTouchArea != null)
+ {
+ __pTouchArea->Initialize(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_MARGIN, rc.width-TOUCH_AREA_MARGIN*2, TOUCH_AREA_WIDTH));
+ __pTouchArea->SetBackgroundColor(Color::GetColor(COLOR_ID_GREY));
+ AddControl(*__pTouchArea);
+
+ __pTouchArea->AddTouchEventListener(*this);
+ Touch touch;
+ touch.SetMultipointEnabled(*__pTouchArea, true);
+ }
+
+ __pDistanceTitle = new (std::nothrow) Label();
+ if (__pDistanceTitle != null)
+ {
+ __pDistanceTitle->Construct(Rectangle(TOUCH_AREA_MARGIN, 420, 150, 50), L"Distance: ");
+ __pDistanceTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDistanceTitle);
+ }
+
+ __pDistance = new (std::nothrow) Label();
+ if (__pDistance != null)
+ {
+ __pDistance->Construct(Rectangle(200, 420, 150, 50), null);
+ __pDistance->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDistance);
+ }
+
+ __pAngleTitle = new (std::nothrow) Label();
+ if (__pAngleTitle != null)
+ {
+ __pAngleTitle->Construct(Rectangle(TOUCH_AREA_MARGIN, 480, 150, 50), L"Angle: ");
+ __pAngleTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pAngleTitle);
+ }
+
+ __pAngle = new (std::nothrow) Label();
+ if (__pAngle != null)
+ {
+ __pAngle->Construct(Rectangle(200, 480, 150, 50), null);
+ __pAngle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pAngle);
+ }
+
+ __pTouchResult = new (std::nothrow) Label();
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->Construct(Rectangle(TOUCH_AREA_MARGIN, 530, 300, 50), null);
+ __pTouchResult->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTouchResult);
+ }
+
+ __pClearButton = new (std::nothrow) Button();
+ if (__pClearButton != null)
+ {
+ __pClearButton->Construct(Rectangle(CLEAR_BUTTON_POS_X, CLEAR_BUTTON_POS_Y, CLEAR_BUTTON_WIDTH, CLEAR_BUTTON_HEIGHT));
+ __pClearButton->SetActionId(ID_BUTTON_CLEAR);
+ __pClearButton->SetText(L"Clear");
+ __pClearButton->AddActionEventListener(*this);
+ AddControl(*__pClearButton);
+ }
+
+ __pRotationGesture = new (std::nothrow) TouchRotationGestureDetector;
+ if (__pRotationGesture != null)
+ {
+ __pRotationGesture->Construct();
+ __pTouchArea->AddGestureDetector(*__pRotationGesture);
+ __pRotationGesture->AddRotationGestureEventListener(*this);
+ }
+
+ return r;
+}
+
+void
+SampleRotationGestureDetectorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SampleRotationGestureDetectorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchResult->SetText(L"");
+ __pTouchResult->Invalidate(false);
+
+ __pAngle->SetText(L"");
+ __pAngle->Invalidate(false);
+
+ __pDistance->SetText(L"");
+ __pDistance->Invalidate(false);
+
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SampleRotationGestureDetectorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SampleRotationGestureDetectorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SampleRotationGestureDetectorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SampleRotationGestureDetectorForm::OnRotationGestureStarted(TouchRotationGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Rotation started!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SampleRotationGestureDetectorForm::OnRotationGestureChanged(TouchRotationGestureDetector& gestureDetector)
+{
+ Rectangle rc(0, 0, 0, 0);
+ Point firstPoint(0, 0);
+ Point secondPoint(0, 0);
+
+ if (__pTouchArea != null)
+ {
+ rc = __pTouchArea->GetBounds();
+
+ Touch touch;
+ Control* pControl = gestureDetector.GetControl();
+ if (pControl != null)
+ {
+ Tizen::Base::Collection::IList* pList = touch.GetTouchInfoListN(*pControl);
+
+ if (pList != null)
+ {
+ TouchInfo *pFirstTouchInfo = static_cast<TouchInfo *>(pList->GetAt(0));
+ if (pFirstTouchInfo != null)
+ {
+ firstPoint.x = pFirstTouchInfo->position.x;
+ firstPoint.y = pFirstTouchInfo->position.y;
+ }
+
+ TouchInfo *pSecondTouchInfo = static_cast<TouchInfo *>(pList->GetAt(1));
+ if (pSecondTouchInfo != null)
+ {
+ secondPoint.x = pSecondTouchInfo->position.x;
+ secondPoint.y = pSecondTouchInfo->position.y;
+ }
+ }
+ }
+ }
+
+ if (firstPoint.y >= 0 && firstPoint.y <= rc.height
+ && secondPoint.y >= 0 && secondPoint.y <= rc.height)
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Rotation changed!");
+ __pTouchResult->Invalidate(false);
+ }
+
+ if (__pDistance != null)
+ {
+ String string = Integer::ToString(gestureDetector.GetDistance());
+ __pDistance->SetText(string);
+ __pDistance->Invalidate(false);
+ }
+
+ if (__pAngle != null)
+ {
+ String string = Float::ToString(gestureDetector.GetAngle());
+ __pAngle->SetText(string);
+ __pAngle->Invalidate(false);
+ }
+ }
+}
+
+void
+SampleRotationGestureDetectorForm::OnRotationGestureFinished(TouchRotationGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Rotation finished!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SampleRotationGestureDetectorForm::OnRotationGestureCanceled(TouchRotationGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Rotation canceled!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+result
+SampleRotationGestureDetectorForm::OnTerminating(void)
+{
+ if (__pRotationGesture != null)
+ {
+ __pRotationGesture->RemoveRotationGestureEventListener(*this);
+ delete __pRotationGesture;
+ }
+
+ return E_SUCCESS;
+}
+
+void
+SampleRotationGestureDetectorForm::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_CLEAR:
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L" ");
+ __pTouchResult->Invalidate(false);
+ }
+
+ if (__pAngle != null)
+ {
+ __pAngle->SetText(L" ");
+ __pAngle->Invalidate(false);
+ }
+
+ if (__pDistance != null)
+ {
+ __pDistance->SetText(L" ");
+ __pDistance->Invalidate(false);
+ }
+
+ __pTouchArea->Clear();
+ __pTouchArea->Invalidate(false);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 SampleTapGestureDetectorForm.cpp
+* @brief This is the implementation file for SampleTapGestureDetectorForm class.
+*/
+
+#include "MainForm.h"
+#include "SampleTapGestureDetectorForm.h"
+
+using namespace Tizen::Ui;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+
+SampleTapGestureDetectorForm::SampleTapGestureDetectorForm(void)
+ : __pIntervalLabel(null)
+ , __pTapCountLabel(null)
+ , __pFingerCountLabel(null)
+ , __pInterval(null)
+ , __pTapCount(null)
+ , __pFingerCount(null)
+ , __pTouchArea(null)
+ , __pTouchResult(null)
+ , __pTapGesture(null)
+ , __previousInterval(0)
+ , __previousTapCount(0)
+ , __previousTouchCount(0)
+ , __gestureDetected(false)
+{
+}
+
+SampleTapGestureDetectorForm::~SampleTapGestureDetectorForm()
+{
+}
+
+bool
+SampleTapGestureDetectorForm::Initialize(void)
+{
+ Construct(FORM_STYLE_NORMAL| FORM_STYLE_INDICATOR| FORM_STYLE_HEADER| FORM_STYLE_FOOTER);
+
+ Footer* pFooter = GetFooter();
+ if (pFooter != null)
+ {
+ pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ pFooter->SetBackButton();
+ }
+
+ return true;
+}
+
+result
+SampleTapGestureDetectorForm::OnInitializing(void)
+{
+ BaseForm::OnInitializing();
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ if (pHeader != null)
+ {
+ pHeader->SetTitleText(L"TOUCH TAP GESTURE DETECTOR");
+ }
+
+ Rectangle rc;
+ rc = GetClientAreaBounds();
+
+ __pIntervalLabel = new (std::nothrow) Label();
+ if (__pIntervalLabel != null)
+ {
+ __pIntervalLabel->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_MARGIN, CONDITION_WIDTH, CONDITION_HEIGHT), L"Tap Interval : ");
+ __pIntervalLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pIntervalLabel);
+ }
+
+ __pInterval = new (std::nothrow) EditField();
+ if (__pInterval != null)
+ {
+ __pInterval->Construct(Rectangle(INTERVAL_CONDITION_POS_X, TOUCH_AREA_MARGIN, CONDITION_WIDTH, CONDITION_HEIGHT), EDIT_FIELD_STYLE_NUMBER_SMALL, INPUT_STYLE_FULLSCREEN, false, INTERVAL_MAX);
+ __pInterval->AddTextEventListener(*this);
+ __pInterval->SetText(L"330");
+ AddControl(*__pInterval);
+ }
+
+ __pTapCountLabel = new (std::nothrow) Label();
+ if (__pTapCountLabel != null)
+ {
+ __pTapCountLabel->Construct(Rectangle(TOUCH_AREA_MARGIN, TAP_COUNT_CONDITION_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), L"Tap Count : ");
+ __pTapCountLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTapCountLabel);
+ }
+
+ __pTapCount = new (std::nothrow) EditField();
+ if (__pTapCount != null)
+ {
+ __pTapCount->Construct(Rectangle(INTERVAL_CONDITION_POS_X, TAP_COUNT_CONDITION_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), EDIT_FIELD_STYLE_NUMBER_SMALL, INPUT_STYLE_FULLSCREEN, false, TAP_COUNT_MAX);
+ __pTapCount->AddTextEventListener(*this);
+ __pTapCount->SetText(L"2");
+ AddControl(*__pTapCount);
+ }
+
+ __pFingerCountLabel = new (std::nothrow) Label();
+ if (__pFingerCountLabel != null)
+ {
+ __pFingerCountLabel->Construct(Rectangle(TOUCH_AREA_MARGIN, FINGER_COUNT_CONDITION_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), L"Finger Count : ");
+ __pFingerCountLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pFingerCountLabel);
+ }
+
+ __pFingerCount = new (std::nothrow) EditField();
+ if (__pFingerCount != null)
+ {
+ __pFingerCount->Construct(Rectangle(FINGER_COUNT_CONDITION_POS_X, FINGER_COUNT_CONDITION_POS_Y, CONDITION_WIDTH, CONDITION_HEIGHT), EDIT_FIELD_STYLE_NUMBER_SMALL, INPUT_STYLE_FULLSCREEN, false, TOUCH_COUNT_MAX);
+ __pFingerCount->AddTextEventListener(*this);
+ __pFingerCount->SetText(L"1");
+ AddControl(*__pFingerCount);
+ }
+
+ __pTouchArea = new (std::nothrow) TouchAreaPanel();
+ if (__pTouchArea != null)
+ {
+ __pTouchArea->Initialize(Rectangle(TOUCH_AREA_MARGIN, TOUCH_AREA_POS_Y, rc.width - TOUCH_AREA_MARGIN * 2, TOUCH_AREA_HEIGHT));
+ __pTouchArea->SetBackgroundColor(Color::GetColor(COLOR_ID_GREY));
+ AddControl(*__pTouchArea);
+
+ __pTouchArea->AddTouchEventListener(*this);
+ Touch touch;
+ touch.SetMultipointEnabled(*__pTouchArea, true);
+ }
+
+ __pTouchResult = new (std::nothrow) Label();
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->Construct(Rectangle(TOUCH_AREA_MARGIN, TOUCH_RESULT_POS_Y, TOUCH_RESULT_WIDTH, TOUCH_RESULT_HEIGHT), null);
+ __pTouchResult->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pTouchResult);
+ }
+
+ __pClearButton = new (std::nothrow) Button();
+ if (__pClearButton != null)
+ {
+ __pClearButton->Construct(Rectangle(CLEAR_BUTTON_POS_X, CLEAR_BUTTON_POS_Y, CLEAR_BUTTON_WIDTH, CLEAR_BUTTON_HEIGHT));
+ __pClearButton->SetActionId(ID_BUTTON_CLEAR);
+ __pClearButton->SetText(L"Clear");
+ __pClearButton->AddActionEventListener(*this);
+ AddControl(*__pClearButton);
+ }
+
+ __pTapGesture = new (std::nothrow) TouchTapGestureDetector;
+ if (__pTapGesture != null)
+ {
+ __pTapGesture->Construct();
+ __pTouchArea->AddGestureDetector(*__pTapGesture);
+ __pTapGesture->AddTapGestureEventListener(*this);
+ __previousInterval = __pTapGesture->GetTapInterval();
+ __previousTapCount = __pTapGesture->GetTapCount();
+ __previousTouchCount = __pTapGesture->GetTouchCount();
+ }
+
+ return r;
+}
+
+void
+SampleTapGestureDetectorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SampleTapGestureDetectorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ __pTouchResult->SetText(L"");
+ __pTouchResult->Invalidate(false);
+
+ __gestureDetected = false;
+
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+}
+
+void
+SampleTapGestureDetectorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+ if (__gestureDetected == false)
+ {
+ __pTouchArea->DrawCircle(currentPosition, Color::GetColor(COLOR_ID_BLACK));
+ __pTouchArea->Invalidate(false);
+ }
+}
+
+void
+SampleTapGestureDetectorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SampleTapGestureDetectorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
+{
+}
+
+void
+SampleTapGestureDetectorForm::OnTapGestureDetected(TouchTapGestureDetector& gestureDetector)
+{
+ Rectangle rc(0, 0, 0, 0);
+ Point point(0, 0);
+
+ if (__pTouchArea != null)
+ {
+ rc = __pTouchArea->GetBounds();
+
+ Touch touch;
+ int fingerCount = 0;
+ Tizen::Base::Integer::Decode(__pFingerCount->GetText(), fingerCount);
+ for(int i=0; i < fingerCount; i++)
+ {
+ point = touch.GetPosition(*__pTouchArea, i);
+
+ if (point.y < 0 || point.y > rc.height)
+ {
+ return;
+ }
+ __pTouchArea->DrawCircle(point, Color::GetColor(COLOR_ID_RED));
+ }
+ __pTouchArea->Invalidate(false);
+ }
+
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Tap detected!");
+ __pTouchResult->Invalidate(false);
+ }
+
+ __gestureDetected = true;
+}
+
+void
+SampleTapGestureDetectorForm::OnTapGestureCanceled(TouchTapGestureDetector& gestureDetector)
+{
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L"Tap canceled!");
+ __pTouchResult->Invalidate(false);
+ }
+}
+
+void
+SampleTapGestureDetectorForm::OnTextValueChanged(const Control& source)
+{
+ EditField* pEditfield = dynamic_cast<EditField*>(const_cast<Control*>(&source));
+ result r = E_SUCCESS;
+
+ if (pEditfield != null)
+ {
+ if (pEditfield == __pInterval)
+ {
+ __previousInterval = __pTapGesture->GetTapInterval();
+
+ Tizen::Base::String string = pEditfield->GetText();
+ int interval = 0;
+ Tizen::Base::Integer::Decode(string, interval);
+
+ const wchar_t* pChars = string.GetPointer();
+ bool isDigit = true;
+ for(int i=0; i< string.GetLength(); i++)
+ {
+ isDigit = Tizen::Base::Character::IsDigit(*(pChars+i));
+ if (!isDigit)
+ {
+ break;
+ }
+ }
+
+ if (!isDigit)
+ {
+ __pTouchResult->SetText(L"Input only numbers!");
+ __pInterval->SetText(Tizen::Base::Integer::ToString(__previousInterval));
+ __pTapGesture->SetTapInterval(__previousInterval);
+ }
+ else
+ {
+ if (interval > 100000)
+ {
+ __pTouchResult->SetText(L"The interval should be below 100000!");
+ __pInterval->SetText(L"100000");
+ __pTapGesture->SetTapInterval(100000);
+ }
+ else if (interval < 200)
+ {
+ __pTouchResult->SetText(L"The interval should be over 200!");
+ __pInterval->SetText(L"200");
+ __pTapGesture->SetTapInterval(200);
+ }
+ else
+ {
+ r = __pTapGesture->SetTapInterval(interval);
+ if (r != E_SUCCESS)
+ {
+ __pTouchResult->SetText(L"The interval should be over 1.");
+ __pInterval->SetText(Tizen::Base::Integer::ToString(__previousInterval));
+ }
+ else
+ {
+ __pTouchResult->SetText(L"");
+ }
+ }
+ }
+ }
+ else if (pEditfield == __pTapCount)
+ {
+ __previousTapCount = __pTapGesture->GetTapCount();
+
+ Tizen::Base::String string = pEditfield->GetText();
+ int count = 0;
+ Tizen::Base::Integer::Decode(string, count);
+
+ const wchar_t* pChars = string.GetPointer();
+ bool isDigit = true;
+ for(int i=0; i< string.GetLength(); i++)
+ {
+ isDigit = Tizen::Base::Character::IsDigit(*(pChars+i));
+ if (!isDigit)
+ {
+ break;
+ }
+ }
+
+ if (!isDigit)
+ {
+ __pTouchResult->SetText(L"Input only numbers!");
+ __pTapCount->SetText(Tizen::Base::Integer::ToString(__previousTapCount));
+ __pTapGesture->SetTapCount(__previousTapCount);
+ }
+ else
+ {
+ if (count > 10)
+ {
+ __pTouchResult->SetText(L"The tap count should be below 10.");
+ __pTapCount->SetText(L"10");
+ __pTapGesture->SetTapCount(10);
+ }
+ else
+ {
+ r = __pTapGesture->SetTapCount(count);
+ if (r != E_SUCCESS)
+ {
+ __pTouchResult->SetText(L"The tap count should be over 1.");
+ __pTapCount->SetText(Tizen::Base::Integer::ToString(__previousTapCount));
+ }
+ else
+ {
+ __pTouchResult->SetText(L"");
+ }
+ }
+ }
+ }
+ else if (pEditfield == __pFingerCount)
+ {
+ __previousTouchCount = __pTapGesture->GetTouchCount();
+
+ Tizen::Base::String string = pEditfield->GetText();
+ int count = 0;
+ Tizen::Base::Integer::Decode(string, count);
+
+ const wchar_t* pChars = string.GetPointer();
+ bool isDigit = true;
+ for(int i=0; i< string.GetLength(); i++)
+ {
+ isDigit = Tizen::Base::Character::IsDigit(*(pChars+i));
+ if (!isDigit)
+ {
+ break;
+ }
+ }
+
+ if (!isDigit)
+ {
+ __pTouchResult->SetText(L"Input only numbers!");
+ __pFingerCount->SetText(Tizen::Base::Integer::ToString(__previousTouchCount));
+ __pTapGesture->SetTouchCount(__previousTouchCount);
+ }
+ else
+ {
+ int maxTouchPoints = 0;
+ result r = Tizen::System::SystemInfo::GetValue(L"MultiPointTouchCount", maxTouchPoints);
+ if (r == E_SUCCESS)
+ {
+ if (count > maxTouchPoints)
+ {
+ Tizen::Base::String output = L"The touch count should be below ";
+ __pTouchResult->SetText(output+Tizen::Base::Integer::ToString(maxTouchPoints));
+ __pFingerCount->SetText(Tizen::Base::Integer::ToString(maxTouchPoints));
+ __pTapGesture->SetTouchCount(maxTouchPoints);
+ }
+ else
+ {
+ r = __pTapGesture->SetTouchCount(count);
+ if (r != E_SUCCESS)
+ {
+ __pTouchResult->SetText(L"The touch count should be over 1.");
+ __pFingerCount->SetText(Tizen::Base::Integer::ToString(__previousTouchCount));
+ }
+ else
+ {
+ __pTouchResult->SetText(L"");
+ }
+ }
+ }
+ }
+ }
+ __pTouchResult->Invalidate(false);
+ }
+
+ SetFocus();
+}
+
+void
+SampleTapGestureDetectorForm::OnTextValueChangeCanceled(const Control& source)
+{
+ SetFocus();
+}
+
+result
+SampleTapGestureDetectorForm::OnTerminating(void)
+{
+ if (__pTapGesture != null)
+ {
+ __pTapGesture->RemoveTapGestureEventListener(*this);
+ delete __pTapGesture;
+ }
+
+ return E_SUCCESS;
+}
+
+void
+SampleTapGestureDetectorForm::OnActionPerformed(const Control& source, int actionId)
+{
+ switch (actionId)
+ {
+ case ID_BUTTON_CLEAR:
+ {
+ if (__pTouchResult != null)
+ {
+ __pTouchResult->SetText(L" ");
+ __pTouchResult->Invalidate(false);
+ }
+
+ __pTouchArea->Clear();
+ __pTouchArea->Invalidate(false);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+#include "TouchAreaPanel.h"
+
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+
+TouchAreaPanel::TouchAreaPanel()
+ : __pCanvas(null)
+{
+}
+
+TouchAreaPanel::~TouchAreaPanel()
+{
+ if (__pCanvas)
+ {
+ delete __pCanvas;
+ }
+}
+
+result
+TouchAreaPanel::Initialize(const Tizen::Graphics::Rectangle& rect)
+{
+ return Panel::Construct(rect);
+}
+
+result
+TouchAreaPanel::OnInitializing(void)
+{
+ __pCanvas = new (std::nothrow) Canvas();
+ if (__pCanvas != null)
+ {
+ const Dimension panelSize = GetSize();
+ result r = __pCanvas->Construct(Rectangle(0, 0, panelSize.width, panelSize.height));
+
+ if (r == E_SUCCESS)
+ {
+ Clear();
+ }
+ }
+
+ return E_SUCCESS;
+}
+
+result
+TouchAreaPanel::OnDraw(void)
+{
+ const Dimension panelSize = GetSize();
+ Canvas* pCanvas = GetCanvasN();
+ if (pCanvas != null)
+ {
+ if (__pCanvas)
+ {
+ pCanvas->Copy(Point(0, 0), *__pCanvas, Rectangle(0, 0, panelSize.width, panelSize.height));
+ }
+ delete pCanvas;
+ }
+ return E_SUCCESS;
+}
+
+void
+TouchAreaPanel::DrawCircle(const Tizen::Graphics::Point& point, const Tizen::Graphics::Color& color)
+{
+ if (__pCanvas)
+ {
+ Rectangle rcCircle(Point(point.x - ELLIPSE_RADIUS, point.y - ELLIPSE_RADIUS), Dimension(ELLIPSE_RADIUS * 2, ELLIPSE_RADIUS * 2));
+ __pCanvas->FillEllipse(color, rcCircle);
+ }
+}
+
+void
+TouchAreaPanel::Clear(void)
+{
+ if (__pCanvas)
+ {
+ __pCanvas->SetBackgroundColor(Color::GetColor(COLOR_ID_GREY));
+ __pCanvas->Clear();
+ }
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 UiGestureDetector.cpp
+* @brief This is the implementation file for UiGestureDetector class.
+*/
+
+#include "FormFactory.h"
+#include "UiGestureDetector.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+UiGestureDetector::UiGestureDetector(void)
+{
+}
+
+UiGestureDetector::~UiGestureDetector(void)
+{
+}
+
+UiApp*
+UiGestureDetector::CreateInstance(void)
+{
+ // Create the instance through the constructor.
+ return new (std::nothrow) UiGestureDetector();
+}
+
+bool
+UiGestureDetector::OnAppInitializing(AppRegistry& appRegistry)
+{
+ Frame* pAppFrame = new (std::nothrow) Frame();
+ pAppFrame->Construct();
+ AddFrame(*pAppFrame);
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+ static FormFactory formFactory;
+
+ pSceneManager->RegisterFormFactory(formFactory);
+ pSceneManager->RegisterScene(L"MainScene", L"MainForm", L"");
+ pSceneManager->RegisterScene(L"SampleLongPressGestureDetectorScene", L"SampleLongPressGestureDetectorForm", L"");
+ pSceneManager->RegisterScene(L"SampleTapGestureDetectorScene", L"SampleTapGestureDetectorForm", L"");
+ pSceneManager->RegisterScene(L"SampleFlickGestureDetectorScene", L"SampleFlickGestureDetectorForm", L"");
+ pSceneManager->RegisterScene(L"SamplePinchGestureDetectorScene", L"SamplePinchGestureDetectorForm", L"");
+ pSceneManager->RegisterScene(L"SampleCustomGestureDetectorScene", L"SampleCustomGestureDetectorForm", L"");
+ pSceneManager->RegisterScene(L"SampleRotationGestureDetectorScene", L"SampleRotationGestureDetectorForm", L"");
+ pSceneManager->RegisterScene(L"SamplePanningGestureDetectorScene", L"SamplePanningGestureDetectorForm", L"");
+
+ if (pSceneManager->GoForward(ForwardSceneTransition(L"MainScene")) != E_SUCCESS)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool
+UiGestureDetector::OnAppInitialized(void)
+{
+ return true;
+}
+
+bool
+UiGestureDetector::OnAppWillTerminate(void)
+{
+ return true;
+}
+
+
+bool
+UiGestureDetector::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+{
+ return true;
+}
+
+void
+UiGestureDetector::OnForeground(void)
+{
+}
+
+void
+UiGestureDetector::OnBackground(void)
+{
+}
+
+void
+UiGestureDetector::OnLowMemory(void)
+{
+}
+
+void
+UiGestureDetector::OnBatteryLevelChanged(BatteryLevel batteryLevel)
+{
+}
+
+void
+UiGestureDetector::OnScreenOn (void)
+{
+}
+
+void
+UiGestureDetector::OnScreenOff (void)
+{
+}
--- /dev/null
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+/**
+ * This file contains the Tizen C++ application entry point.
+ */
+#include <new>
+#include "UiGestureDetector.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+_EXPORT_ int OspMain(int argc, char* pArgv[]);
+
+/**
+ * The entry function of Tizen C++ application called by the operating system.
+ */
+int
+OspMain(int argc, char* pArgv[])
+{
+ AppLog("Application started.");
+ ArrayList args;
+ args.Construct();
+ for (int i = 0; i < argc; i++)
+ {
+ args.Add(*(new (std::nothrow) String(pArgv[i])));
+ }
+
+ result r = Tizen::App::Application::Execute(UiGestureDetector::CreateInstance, &args);
+ TryLog(r == E_SUCCESS, "[%s] Application execution failed", GetErrorMessage(r));
+
+ args.RemoveAll(true);
+ AppLog("Application finished.");
+ return static_cast<int>(r);
+}
+#ifdef __cplusplus
+}
+#endif // __cplusplus
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template>
+
+ <slp-property>
+ <property-group>
+ <sample-name>UiGestureDetector</sample-name>
+ <category>Sample</category>
+ <sdk-version>1.00</sdk-version>
+ <project-type>org.tizen.nativecpp.buildArtefactType.app</project-type>
+ <sample-description>description.xml</sample-description>
+ </property-group>
+ </slp-property>
+
+ <process type="org.tizen.nativeappcommon.TizenCopyFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="folderPath" value="project"/>
+ <complex-array name="replaceableFiles">
+ <element>
+ <simple name="sourcePath" value="manifest.xml"/>
+ <simple name="targetPath" value="manifest.xml"/>
+ <simple name="replaceable" value = "true"/>
+ </element>
+ </complex-array>
+ </process>
+ <process type="org.tizen.nativecpp.SetDefaultFrameworks">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="frameworkList">
+ <element>
+ <simple name="framework" value="osp"/>
+ </element>
+ </complex-array>
+ </process>
+
+</template>