sync with master
authorJinkun Jang <jinkun.jang@samsung.com>
Mon, 18 Mar 2013 06:31:40 +0000 (15:31 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Mon, 18 Mar 2013 06:31:40 +0000 (15:31 +0900)
26 files changed:
LICENSE.Flora [new file with mode: 0644]
NOTICE [new file with mode: 0644]
description.xml [new file with mode: 0644]
project/data/nofile.dummy [new file with mode: 0644]
project/inc/AppWidgetViewer.h [new file with mode: 0644]
project/inc/AppWidgetViewerFormFactory.h [new file with mode: 0644]
project/inc/AppWidgetViewerFrame.h [new file with mode: 0644]
project/inc/AppWidgetViewerMainForm.h [new file with mode: 0644]
project/inc/AppWidgetViewerPanelFactory.h [new file with mode: 0644]
project/inc/ViewForm.h [new file with mode: 0644]
project/manifest.xml [new file with mode: 0644]
project/res/.workflow [new file with mode: 0644]
project/res/screen-size-normal/IDF_FORM.xml [new file with mode: 0644]
project/res/screen-size-normal/IDF_VIEW_FORM.xml [new file with mode: 0644]
project/shared/data/nofile.dummy [new file with mode: 0644]
project/shared/res/screen-density-xhigh/mainmenu.png [new file with mode: 0755]
project/shared/trusted/nofile.dummy [new file with mode: 0644]
project/src/AppWidgetViewer.cpp [new file with mode: 0644]
project/src/AppWidgetViewerEntry.cpp [new file with mode: 0644]
project/src/AppWidgetViewerFormFactory.cpp [new file with mode: 0644]
project/src/AppWidgetViewerFrame.cpp [new file with mode: 0644]
project/src/AppWidgetViewerMainForm.cpp [new file with mode: 0644]
project/src/AppWidgetViewerPanelFactory.cpp [new file with mode: 0644]
project/src/ViewForm.cpp [new file with mode: 0644]
sample.xml [new file with mode: 0644]
screenshot.png [new file with mode: 0644]

diff --git a/LICENSE.Flora b/LICENSE.Flora
new file mode 100644 (file)
index 0000000..9c95663
--- /dev/null
@@ -0,0 +1,206 @@
+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.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..3997999
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,4 @@
+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.
+
diff --git a/description.xml b/description.xml
new file mode 100644 (file)
index 0000000..d855f40
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<?xml-stylesheet type="text/xsl" href="../../../../description.xsl"?>
+
+<Overview version="0.17.1">
+  <SampleName> AppWidgetViewer </SampleName>
+  <SampleVersion>1.0</SampleVersion>
+  <Preview>screenshot.png</Preview>
+  <Description>
+    The AppWidgetViewer sample application demonstrates how you can construct AppWidgetView control to implement user AppWidgetViewer.
+  </Description>
+</Overview>
diff --git a/project/data/nofile.dummy b/project/data/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/inc/AppWidgetViewer.h b/project/inc/AppWidgetViewer.h
new file mode 100644 (file)
index 0000000..386524e
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 _APPWIDGET_VIEWER_H_
+#define _APPWIDGET_VIEWER_H_
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FSystem.h>
+#include <FUi.h>
+
+/**
+ * [AppWidgetViewerApp] UiApp must inherit from UiApp class
+ * which provides basic features necessary to define an UiApp.
+ */
+class AppWidgetViewerApp
+       : public Tizen::App::UiApp
+       , public Tizen::System::IScreenEventListener
+{
+public:
+       static Tizen::App::UiApp* CreateInstance(void);
+
+public:
+       AppWidgetViewerApp(void);
+       virtual~AppWidgetViewerApp(void);
+
+public:
+       // Called when the UiApp is initializing.
+       bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
+
+       // Called when the UiApp initializing is finished. 
+       bool OnAppInitialized(void); 
+
+       // Called when the UiApp is requested to terminate. 
+       bool OnAppWillTerminate(void); 
+
+       // Called when the UiApp is terminating.
+       bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
+
+       // Called when the UiApp's frame moves to the top of the screen.
+       void OnForeground(void);
+
+       // Called when this UiApp's frame is moved from top of the screen to the background.
+       void OnBackground(void);
+
+       // Called when the system memory is not sufficient to run the UiApp any further.
+       void OnLowMemory(void);
+
+       // Called when the battery level changes.
+       void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
+
+       // Called when the screen turns on.
+       void OnScreenOn(void);
+
+       // Called when the screen turns off.
+       void OnScreenOff(void);
+
+       void PrintAppWidgetProviderInfos();
+}; // AppWidgetViewerApp
+
+#endif // _APPWIDGET_VIEWER_H_
diff --git a/project/inc/AppWidgetViewerFormFactory.h b/project/inc/AppWidgetViewerFormFactory.h
new file mode 100644 (file)
index 0000000..50baec7
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 _APPWIDGET_VIEWER_FORM_FACTORY_H_
+#define _APPWIDGET_VIEWER_FORM_FACTORY_H_
+
+#include <FUi.h>
+
+extern const wchar_t* MAIN_FORM;
+extern const wchar_t* VIEW_FORM;
+extern const wchar_t* MAIN_SCENE;
+extern const wchar_t* VIEW_SCENE;
+
+class AppWidgetViewerFormFactory
+       : public Tizen::Ui::Scenes::IFormFactory
+{
+public:
+       AppWidgetViewerFormFactory(void);
+       virtual ~AppWidgetViewerFormFactory(void);
+
+       virtual Tizen::Ui::Controls::Form* CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId);
+}; // AppWidgetViewerFormFactory
+
+#endif // _APPWIDGET_VIEWER_FORM_FACTORY_H_
diff --git a/project/inc/AppWidgetViewerFrame.h b/project/inc/AppWidgetViewerFrame.h
new file mode 100644 (file)
index 0000000..17a36d6
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 _APPWIDGET_VIEWER_FRAME_H_
+#define _APPWIDGET_VIEWER_FRAME_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+class AppWidgetViewerFrame
+       : public Tizen::Ui::Controls::Frame
+{
+public:
+       AppWidgetViewerFrame(void);
+       virtual ~AppWidgetViewerFrame(void);
+
+public:
+       virtual result OnInitializing(void);
+       virtual result OnTerminating(void);
+}; // AppWidgetViewerFrame
+
+#endif // _APPWIDGET_VIEWER_FRAME_H_
diff --git a/project/inc/AppWidgetViewerMainForm.h b/project/inc/AppWidgetViewerMainForm.h
new file mode 100644 (file)
index 0000000..b0b8d5b
--- /dev/null
@@ -0,0 +1,74 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 _APPWIDGET_VIEWER_MAIN_FORM_H_
+#define _APPWIDGET_VIEWER_MAIN_FORM_H_
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FUi.h>
+#include <FShellAppWidgetProviderInfo.h>
+
+class AppWidgetViewerMainForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::IActionEventListener
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Scenes::ISceneEventListener
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+       , public Tizen::App::IAppControlResponseListener
+{
+public:
+       AppWidgetViewerMainForm(void);
+       virtual ~AppWidgetViewerMainForm(void);
+       bool Initialize(void);
+
+public:
+       virtual result OnInitializing(void);
+       virtual result OnTerminating(void);
+       virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+       virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
+                                                                  const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
+       virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
+                                                                       const Tizen::Ui::Scenes::SceneId& nextSceneId);
+
+private:
+       //ListView
+       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);
+       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 OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
+       void StartConfigurationAppControl(const Tizen::Base::String& appId, const Tizen::Base::String& providerName);
+       void GoAppWidgetViewScene(const Tizen::Base::String& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& displayName, const Tizen::Base::String& userInfo);
+
+private:
+       static const int ID_FORMAT_STRING = 500;
+       static const int ID_FORMAT_BITMAP = 501;
+
+       Tizen::Ui::Controls::ListView* __pList;
+       Tizen::Base::Collection::IList* __pAppWidgetProviderList;
+       Tizen::Base::Collection::ArrayList* __pAppWidgetIconList;
+       Tizen::Shell::AppWidgetProviderInfo* __pSelectedProviderInfo;
+}; // AppWidgetViewerMainForm
+
+#endif // _APPWIDGET_VIEWER_MAIN_FORM_H_
diff --git a/project/inc/AppWidgetViewerPanelFactory.h b/project/inc/AppWidgetViewerPanelFactory.h
new file mode 100644 (file)
index 0000000..feac309
--- /dev/null
@@ -0,0 +1,33 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 _APPWIDGET_VIEWER_PANEL_FACTORY_H_
+#define _APPWIDGET_VIEWER_PANEL_FACTORY_H_
+
+#include <FUi.h>
+
+class AppWidgetViewerPanelFactory
+       : public Tizen::Ui::Scenes::IPanelFactory
+{
+public:
+       AppWidgetViewerPanelFactory(void);
+       virtual ~AppWidgetViewerPanelFactory(void);
+
+       virtual Tizen::Ui::Controls::Panel* CreatePanelN(const Tizen::Base::String& panelId, const Tizen::Ui::Scenes::SceneId& sceneId);
+}; // AppWidgetViewerPanelFactory
+
+#endif // _APPWIDGET_VIEWER_PANEL_FACTORY_H_
diff --git a/project/inc/ViewForm.h b/project/inc/ViewForm.h
new file mode 100644 (file)
index 0000000..85d5964
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 _VIEW_FORM_H_
+#define _VIEW_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+namespace Tizen { namespace Shell
+{
+class AppWidgetView;
+}} // Tizen::Shell
+
+class ViewForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::IActionEventListener
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Scenes::ISceneEventListener
+{
+public:
+       ViewForm(void);
+       virtual ~ViewForm(void);
+       bool Initialize();
+       virtual result OnInitializing(void);
+       virtual result OnTerminating(void);
+
+private:
+       void CreateAppWidgetView(const Tizen::Base::String& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo);
+       virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+       virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
+       virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
+
+private:
+       Tizen::Shell::AppWidgetView* __pAppWidgetView;
+       Tizen::Ui::Controls::ContextMenu* __pContextMenu;
+       Tizen::Base::Collection::IList* __pSizeInfoList;
+       static const int ID_FOOTER_ITEM1 = 1001;
+}; // ViewForm
+
+#endif // _VIEW_FORM_H_
\ No newline at end of file
diff --git a/project/manifest.xml b/project/manifest.xml
new file mode 100644 (file)
index 0000000..81fd636
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Manifest xmlns="http://schemas.tizen.org/2012/12/manifest">
+    <Id>$(manifestAppId)</Id>
+    <Version>2.0.0</Version>
+    <Type>C++App</Type>
+    <Author/>
+    <Apps>
+        <ApiVersion>2.1</ApiVersion>
+        <Privileges>
+            <Privilege>http://tizen.org/privilege/application.launch</Privilege>
+        </Privileges>
+        <UiApp Main="True" MenuIconVisible="True" Name="$(projectName)">
+            <UiScalability BaseScreenSize="Normal" CoordinateSystem="Logical" LogicalCoordinate="720"/>
+            <UiTheme SystemTheme="White"/>
+            <DisplayNames>
+                <DisplayName Locale="eng-GB">$(projectName)</DisplayName>
+            </DisplayNames>
+            <Icons>
+                <Icon Section="MainMenu" Type="Xhigh">mainmenu.png</Icon>
+            </Icons>
+        </UiApp>
+    </Apps>
+</Manifest>
diff --git a/project/res/.workflow b/project/res/.workflow
new file mode 100644 (file)
index 0000000..b7228a4
Binary files /dev/null and b/project/res/.workflow differ
diff --git a/project/res/screen-size-normal/IDF_FORM.xml b/project/res/screen-size-normal/IDF_FORM.xml
new file mode 100644 (file)
index 0000000..b232bc7
--- /dev/null
@@ -0,0 +1,21 @@
+<?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.201211071904" Dversion="20120315">
+    <LogicalCoordinate>720</LogicalCoordinate>
+    <Form id="IDF_FORM">
+        <property backgroundColor="" backgroundColorOpacity="100" orientation="Portrait" 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|FORM_STYLE_FOOTER" type="LAYOUT_RELATIVE"/>
+        <layout mode="Landscape" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="LAYOUT_RELATIVE"/>
+    </Form>
+    <Footer>
+        <property backgroundBitmapPath="" color="" colorOpacity="0" disabledButtonColor="" disabledButtonColorOpacity="0" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="0" disabledItemTextColor="" footerStyle="FOOTER_STYLE_BUTTON_TEXT" highlightedButtonColor="" highlightedButtonColorOpacity="0" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="0" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="0" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="0" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="0" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="0" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor="" showBackButton="true"/>
+        <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="" pressedItemColor="" pressedItemColorOpacity="0" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor="" titleIconPath="" titleText="APPWIDGET VIEWER" titleTextColor=""/>
+        <itemSet/>
+    </Header>
+</Scene>
diff --git a/project/res/screen-size-normal/IDF_VIEW_FORM.xml b/project/res/screen-size-normal/IDF_VIEW_FORM.xml
new file mode 100644 (file)
index 0000000..69f4751
--- /dev/null
@@ -0,0 +1,23 @@
+<?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.201211071904" Dversion="20120315">
+    <LogicalCoordinate>720</LogicalCoordinate>
+    <Form id="IDF_VIEW_FORM">
+        <property backgroundColor="" backgroundColorOpacity="100" orientation="Portrait" 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|FORM_STYLE_FOOTER" type="NONE"/>
+        <layout mode="Landscape" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="NONE"/>
+    </Form>
+    <Footer>
+        <property backgroundBitmapPath="" color="" colorOpacity="100" disabledButtonColor="" disabledButtonColorOpacity="100" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="100" disabledItemTextColor="" footerStyle="FOOTER_STYLE_BUTTON_TEXT" highlightedButtonColor="" highlightedButtonColorOpacity="100" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="100" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="100" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="100" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="100" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="100" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="100" selectedItemTextColor="" showBackButton="true"/>
+        <itemSet>
+            <footerItem actionId="1001" disabledIconPath="" highlightedIconPath="" normalIconPath="" pressedIconPath="" selectedIconPath="" text="Size list"/>
+        </itemSet>
+    </Footer>
+    <Header>
+        <property backgroundBitmapPath="" color="" colorOpacity="100" descriptionText="" descriptionTextColor="" disabledButtonColor="" disabledButtonColorOpacity="100" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="100" disabledItemTextColor="" headerStyle="HEADER_STYLE_TITLE" highlightedButtonColor="" highlightedButtonColorOpacity="100" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="100" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="100" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="100" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="100" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="100" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="100" selectedItemTextColor="" titleIconPath="" titleText="AppWidget" titleTextColor=""/>
+        <itemSet/>
+    </Header>
+</Scene>
diff --git a/project/shared/data/nofile.dummy b/project/shared/data/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/shared/res/screen-density-xhigh/mainmenu.png b/project/shared/res/screen-density-xhigh/mainmenu.png
new file mode 100755 (executable)
index 0000000..983c883
Binary files /dev/null and b/project/shared/res/screen-density-xhigh/mainmenu.png differ
diff --git a/project/shared/trusted/nofile.dummy b/project/shared/trusted/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/src/AppWidgetViewer.cpp b/project/src/AppWidgetViewer.cpp
new file mode 100644 (file)
index 0000000..78e9ac8
--- /dev/null
@@ -0,0 +1,192 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 <unique_ptr.h>
+#include <FShellAppWidgetManager.h>
+#include <FShellAppWidgetProviderInfo.h>
+#include <FShellAppWidgetSizeInfo.h>
+
+#include "AppWidgetViewer.h"
+#include "AppWidgetViewerFrame.h"
+#include "AppWidgetViewerFormFactory.h"
+#include "AppWidgetViewerPanelFactory.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Shell;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+AppWidgetViewerApp::AppWidgetViewerApp(void)
+{
+}
+
+AppWidgetViewerApp::~AppWidgetViewerApp(void)
+{
+}
+
+UiApp*
+AppWidgetViewerApp::CreateInstance(void)
+{
+       // Create the instance through the constructor.
+       return new AppWidgetViewerApp();
+}
+
+bool
+AppWidgetViewerApp::OnAppInitializing(AppRegistry& appRegistry)
+{
+       // TODO:
+       // Initialize Frame and App specific data.
+       // The App's permanent data and context can be obtained from the appRegistry.
+       //
+       // If this method is successful, return true; otherwise, return false.
+       // If this method returns false, the App will be terminated.
+
+       // Uncomment the following statement to listen to the screen on/off events.
+       //PowerManager::SetScreenEventListener(*this);
+
+       // TODO:
+       // Add your initialization code here
+       return true;
+}
+
+bool
+AppWidgetViewerApp::OnAppInitialized(void)
+{
+       PrintAppWidgetProviderInfos();
+
+       // Create a Frame
+       AppWidgetViewerFrame* pAppWidgetViewerFrame = new AppWidgetViewerFrame();
+       pAppWidgetViewerFrame->Construct();
+       pAppWidgetViewerFrame->SetName(L"AppWidgetViewer");
+       AddFrame(*pAppWidgetViewerFrame);
+
+       // Prepare Scene management.
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       static AppWidgetViewerFormFactory formFactory;
+       static AppWidgetViewerPanelFactory panelFactory;
+       pSceneManager->RegisterFormFactory(formFactory);
+       pSceneManager->RegisterPanelFactory(panelFactory);
+       pSceneManager->RegisterScene(MAIN_SCENE, MAIN_FORM, L"");
+       pSceneManager->RegisterScene(VIEW_SCENE, VIEW_FORM, L"");
+
+       // Goto the scene.
+       if (pSceneManager->GoForward(ForwardSceneTransition(MAIN_SCENE)) != E_SUCCESS)
+       {
+               return false;
+       }
+
+       return true;
+}
+
+void
+AppWidgetViewerApp::PrintAppWidgetProviderInfos()
+{
+       AppWidgetManager* pAppWidgetManager = AppWidgetManager::GetInstance();
+       AppAssertf(pAppWidgetManager, "AppWidgetManager creation failed.");
+
+       std::unique_ptr<IList> pAppWidgetProviderInfos(pAppWidgetManager->GetAppWidgetProviderInfoListN() );
+       TryReturnVoid(pAppWidgetProviderInfos.get(), "GetAppWidgetProviderInfoListN returns null!!" );
+       AppLog("All appwidget count (%d)", pAppWidgetProviderInfos->GetCount() );
+
+       for(int i = 0; i < pAppWidgetProviderInfos->GetCount(); i++)
+       {
+               AppWidgetProviderInfo* pProviderInfo = dynamic_cast<AppWidgetProviderInfo*>(pAppWidgetProviderInfos->GetAt(i) );
+
+               std::unique_ptr<IList> pSizeInfos(pProviderInfo->GetSizeInfoListN() );
+               if (pSizeInfos.get() == null)
+               {
+                       continue;
+               }
+               AppLog("appId(%ls), Name(%ls), DisplayName(%ls), iconPath(%ls) support (%d) sizes", pProviderInfo->GetAppId().GetPointer(), pProviderInfo->GetName().GetPointer(), pProviderInfo->GetDisplayName().GetPointer(), pProviderInfo->GetIconPath().GetPointer(),  pSizeInfos->GetCount() );
+
+               for(int j = 0; j < pSizeInfos->GetCount(); j ++)
+               {
+                       AppWidgetSizeInfo* pSizeInfo = dynamic_cast<AppWidgetSizeInfo*>(pSizeInfos->GetAt(j) );
+                       AppLog("size(%f, %f), preview(%ls)", pSizeInfo->GetSize().width, pSizeInfo->GetSize().height, pSizeInfo->GetPreviewImagePath().GetPointer());
+               }
+               pSizeInfos->RemoveAll(true);
+       }
+       pAppWidgetProviderInfos->RemoveAll(true);
+}
+
+bool
+AppWidgetViewerApp::OnAppWillTerminate(void)
+{
+       // TODO:
+       // Comment.
+       return true;
+}
+
+bool
+AppWidgetViewerApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+{
+       // TODO:
+       // Deallocate resources allocated by this App for termination.
+       // The App's permanent data and context can be saved via appRegistry.
+       return true;
+}
+
+void
+AppWidgetViewerApp::OnForeground(void)
+{
+       // TODO:
+       // Start or resume drawing when the application is moved to the foreground.
+}
+
+void
+AppWidgetViewerApp::OnBackground(void)
+{
+       // TODO:
+       // Stop drawing when the application is moved to the background.
+}
+
+void
+AppWidgetViewerApp::OnLowMemory(void)
+{
+       // TODO:
+       // Free unused resources or close the application.
+}
+
+void
+AppWidgetViewerApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)
+{
+       // TODO:
+       // Handle any changes in battery level here.
+       // Stop using multimedia features(camera, mp3 etc.) if the battery level is CRITICAL.
+}
+
+void
+AppWidgetViewerApp::OnScreenOn(void)
+{
+       // TODO:
+       // Get the released resources or resume the operations that were paused or stopped in OnScreenOff().
+}
+
+void
+AppWidgetViewerApp::OnScreenOff(void)
+{
+       // TODO:
+       // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device
+       // to enter the sleep mode to save the battery.
+       // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a
+       // callback before the device enters the sleep mode.
+       // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one.
+}
diff --git a/project/src/AppWidgetViewerEntry.cpp b/project/src/AppWidgetViewerEntry.cpp
new file mode 100644 (file)
index 0000000..287b191
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 application entry point.
+ */
+
+#include "AppWidgetViewer.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 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::UiApp::Execute(AppWidgetViewerApp::CreateInstance, &args);
+       if (IsFailed(r))
+       {
+               AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
+               r &= 0x0000FFFF;
+       }
+
+       args.RemoveAll(true);
+       AppLog("Application finished.");
+
+       return static_cast<int>(r);
+}
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
diff --git a/project/src/AppWidgetViewerFormFactory.cpp b/project/src/AppWidgetViewerFormFactory.cpp
new file mode 100644 (file)
index 0000000..0cbb6dc
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 "AppWidgetViewerFormFactory.h"
+#include "AppWidgetViewerMainForm.h"
+#include "ViewForm.h"
+
+const wchar_t* MAIN_FORM = L"MainForm";
+const wchar_t* VIEW_FORM = L"ViewForm";
+const wchar_t* MAIN_SCENE = L"SceneMain";
+const wchar_t* VIEW_SCENE = L"SceneView";
+
+using namespace Tizen::Ui::Scenes;
+
+AppWidgetViewerFormFactory::AppWidgetViewerFormFactory(void)
+{
+}
+
+AppWidgetViewerFormFactory::~AppWidgetViewerFormFactory(void)
+{
+}
+
+Tizen::Ui::Controls::Form*
+AppWidgetViewerFormFactory::CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+       Tizen::Ui::Controls::Form* pNewForm = null;
+
+       if (formId == MAIN_FORM)
+       {
+               AppWidgetViewerMainForm* pForm = new AppWidgetViewerMainForm();
+               pForm->Initialize();
+               pSceneManager->AddSceneEventListener(sceneId, *pForm);
+               pNewForm = pForm;
+       }
+       else if (formId == VIEW_FORM)
+       {
+               ViewForm* pViewForm = new (std::nothrow) ViewForm();
+               pViewForm->Initialize();
+               pSceneManager->AddSceneEventListener(sceneId, *pViewForm);
+               pNewForm = pViewForm;
+       }
+
+       return pNewForm;
+}
diff --git a/project/src/AppWidgetViewerFrame.cpp b/project/src/AppWidgetViewerFrame.cpp
new file mode 100644 (file)
index 0000000..ac29dd4
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 "AppWidgetViewerFrame.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+AppWidgetViewerFrame::AppWidgetViewerFrame(void)
+{
+}
+
+AppWidgetViewerFrame::~AppWidgetViewerFrame(void)
+{
+}
+
+result
+AppWidgetViewerFrame::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       // TODO:
+       // Add your initialization code here
+       return r;
+}
+
+result
+AppWidgetViewerFrame::OnTerminating(void)
+{
+       result r = E_SUCCESS;
+
+       // TODO:
+       // Add your termination code here
+       return r;
+}
+
diff --git a/project/src/AppWidgetViewerMainForm.cpp b/project/src/AppWidgetViewerMainForm.cpp
new file mode 100644 (file)
index 0000000..8a5fcec
--- /dev/null
@@ -0,0 +1,281 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 <FApp.h>
+#include <FMedia.h>
+#include <FShellAppWidgetProviderInfo.h>
+#include <FShellAppWidgetManager.h>
+#include <FShellAppWidgetSizeInfo.h>
+
+#include "AppWidgetViewerMainForm.h"
+#include "AppWidgetViewerFormFactory.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::App;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Shell;
+
+const int LIST_ITEM_ICON = 72;
+const int LIST_ITEM_HEIGHT = 112;
+const int LIST_ITEM_MARGIN_LEFT = 26;
+const int LIST_ITEM_MARGIN_TOP = 32;
+const int LIST_ITEM_TEXT_HEIGHT = 44;
+
+AppWidgetViewerMainForm::AppWidgetViewerMainForm(void)
+       : __pList(null)
+       , __pAppWidgetProviderList(null)
+{
+       __pAppWidgetProviderList = AppWidgetManager::GetInstance()->GetAppWidgetProviderInfoListN();
+       TryReturnVoid(__pAppWidgetProviderList, "GetAppWidgetListN returns null!!" );
+
+       __pAppWidgetIconList = new ArrayList(SingleObjectDeleter);
+       __pAppWidgetIconList->Construct();
+       for( int i = 0; i < __pAppWidgetProviderList->GetCount(); i++)
+       {
+               AppWidgetProviderInfo* pAppWidgetProviderInfo = dynamic_cast<AppWidgetProviderInfo*>(__pAppWidgetProviderList->GetAt(i) );
+
+               Tizen::Media::Image image;
+               result r = image.Construct();
+               Bitmap* pBmp = image.DecodeN(pAppWidgetProviderInfo->GetIconPath(), BITMAP_PIXEL_FORMAT_ARGB8888);
+
+               __pAppWidgetIconList->Add(pBmp);
+       }
+}
+
+AppWidgetViewerMainForm::~AppWidgetViewerMainForm(void)
+{
+}
+
+bool
+AppWidgetViewerMainForm::Initialize(void)
+{
+       Construct(L"IDF_FORM");
+
+       return true;
+}
+
+result
+AppWidgetViewerMainForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       // Setup back event listener
+       SetFormBackEventListener(this);
+
+       if (!__pAppWidgetProviderList)
+       {
+               AppLog("GetAppWidgetListN returns null!!");
+               return E_SUCCESS;
+       }
+
+       // TODO:
+       // Add your initialization code here
+       __pList = new (std::nothrow) ListView();
+       __pList->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, false);
+       __pList->SetItemProvider(*this);
+       __pList->AddListViewItemEventListener(*this);
+       AddControl(*__pList);
+
+       return r;
+}
+
+result
+AppWidgetViewerMainForm::OnTerminating(void)
+{
+       result r = E_SUCCESS;
+
+       // TODO:
+       // Add your termination code here
+       if (__pAppWidgetProviderList)
+       {
+               __pAppWidgetProviderList->RemoveAll(true);
+               delete __pAppWidgetProviderList;
+       }
+
+       if (__pAppWidgetIconList)
+       {
+               __pAppWidgetIconList->RemoveAll();
+               delete __pAppWidgetIconList;
+       }
+
+       return r;
+}
+
+void
+AppWidgetViewerMainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+
+       switch(actionId)
+       {
+       default:
+               break;
+       }
+}
+
+void
+AppWidgetViewerMainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       UiApp* pApp = UiApp::GetInstance();
+       AppAssert(pApp);
+       pApp->Terminate();
+}
+
+void
+AppWidgetViewerMainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
+                                                                                 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+       // TODO:
+       // Add your scene activate code here
+       AppLog("OnSceneActivatedN");
+}
+
+void
+AppWidgetViewerMainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
+                                                                                  const Tizen::Ui::Scenes::SceneId& nextSceneId)
+{
+       // TODO:
+       // Add your scene deactivate code here
+       AppLog("OnSceneDeactivated");
+}
+
+void
+AppWidgetViewerMainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
+{
+       if(status == LIST_ITEM_STATUS_SELECTED)
+       {
+               __pSelectedProviderInfo = dynamic_cast<AppWidgetProviderInfo*>(__pAppWidgetProviderList->GetAt(index));
+               AppAssert(__pSelectedProviderInfo);
+
+               String configurationAppControlAppId = __pSelectedProviderInfo->GetConfigurationAppControlAppId();
+               if(!configurationAppControlAppId.IsEmpty())
+               {
+                       StartConfigurationAppControl(__pSelectedProviderInfo->GetConfigurationAppControlAppId(), __pSelectedProviderInfo->GetName());
+               }
+               else
+               {
+                       AppLog("%ls", __pSelectedProviderInfo->GetDisplayName().GetPointer());
+                       GoAppWidgetViewScene(__pSelectedProviderInfo->GetAppId(), __pSelectedProviderInfo->GetName(), __pSelectedProviderInfo->GetDisplayName(), L"");
+               }
+       }
+}
+
+void
+AppWidgetViewerMainForm::StartConfigurationAppControl(const Tizen::Base::String& appId, const Tizen::Base::String& providerName)
+{
+       AppControl* pAc = AppManager::FindAppControlN( appId, L"http://tizen.org/appcontrol/operation/livebox/configuration");
+       HashMap extra;
+       extra.Construct();
+       String key = L"ProviderName";
+       String value = providerName;
+       extra.Add(&key, &value);
+
+       pAc->Start(null, null, &extra, this);
+       delete pAc;
+}
+
+void
+AppWidgetViewerMainForm::GoAppWidgetViewScene(const String& appId, const String& providerName, const Tizen::Base::String& displayName, const String& userInfo)
+{
+       ArrayList* pList = new (std::nothrow) ArrayList;
+       AppAssert(pList);
+       pList->Construct();
+
+       pList->Add(*(new (std::nothrow) String(appId) ));
+       pList->Add(*(new (std::nothrow) String(providerName) ));
+       pList->Add(*(new (std::nothrow) String(displayName)));
+       pList->Add(*(new (std::nothrow) String(userInfo )) );
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+
+       pSceneManager->GoForward(ForwardSceneTransition(VIEW_SCENE, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
+       __pSelectedProviderInfo = null;
+}
+
+void
+AppWidgetViewerMainForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView &listView, int index, Tizen::Ui::Controls::SweepDirection direction)
+{
+}
+
+void
+AppWidgetViewerMainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
+{
+}
+
+void
+AppWidgetViewerMainForm::OnItemReordered(Tizen::Ui::Controls::ListView &view, int oldIndex, int newIndex)
+{
+}
+
+int
+AppWidgetViewerMainForm::GetItemCount(void)
+{
+       return __pAppWidgetProviderList->GetCount();
+}
+
+Tizen::Ui::Controls::ListItemBase*
+AppWidgetViewerMainForm::CreateItem (int index, int itemWidth)
+{
+       CustomItem* pItem = new (std::nothrow) CustomItem();
+       pItem->Construct(Tizen::Graphics::Dimension(itemWidth, LIST_ITEM_HEIGHT), LIST_ANNEX_STYLE_NORMAL);
+       
+       Rectangle iconRect(LIST_ITEM_MARGIN_LEFT, LIST_ITEM_MARGIN_TOP/2, LIST_ITEM_ICON, LIST_ITEM_ICON);
+       int text_x = LIST_ITEM_ICON + LIST_ITEM_MARGIN_LEFT + 20;
+       Rectangle textRect(text_x, LIST_ITEM_MARGIN_TOP, GetClientAreaBounds().width - LIST_ITEM_MARGIN_LEFT - text_x, LIST_ITEM_TEXT_HEIGHT);
+       
+       AppWidgetProviderInfo* pProviderInfo = dynamic_cast<AppWidgetProviderInfo*>(__pAppWidgetProviderList->GetAt(index));
+
+       if (pProviderInfo)
+       {
+               Bitmap* pBmp = dynamic_cast<Bitmap*>(__pAppWidgetIconList->GetAt(index));
+
+               pItem->AddElement(iconRect, ID_FORMAT_BITMAP, *pBmp, null, null);
+               pItem->AddElement(textRect, ID_FORMAT_STRING, pProviderInfo->GetDisplayName()+" ("+pProviderInfo->GetAppId()+")", true);
+       }
+
+       return pItem;
+}
+
+bool
+AppWidgetViewerMainForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth)
+{
+       delete pItem;
+       return true;
+}
+
+
+void
+AppWidgetViewerMainForm::OnAppControlCompleteResponseReceived(const AppId& appId, const Tizen::Base::String& operationId, AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
+{
+       String temp;
+       TryReturnVoid(__pSelectedProviderInfo, "__pSelectedProviderInfo should not be null!");
+
+       if(pExtraData)
+       {
+               String userInfokey(L"UserInfo");
+               const String* pUserInfoValue = dynamic_cast<const String*>(pExtraData->GetValue(userInfokey) );
+               AppLog("%ls, %ls, %ls", appId.GetPointer(), operationId.GetPointer(), pUserInfoValue->GetPointer() );
+
+               GoAppWidgetViewScene(__pSelectedProviderInfo->GetAppId(), __pSelectedProviderInfo->GetName(), __pSelectedProviderInfo->GetDisplayName(), *pUserInfoValue);
+       }
+}
diff --git a/project/src/AppWidgetViewerPanelFactory.cpp b/project/src/AppWidgetViewerPanelFactory.cpp
new file mode 100644 (file)
index 0000000..65ae3c6
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 <FUi.h>
+
+#include "AppWidgetViewerPanelFactory.h"
+
+using namespace Tizen::Ui::Scenes;
+
+AppWidgetViewerPanelFactory::AppWidgetViewerPanelFactory(void)
+{
+}
+
+AppWidgetViewerPanelFactory::~AppWidgetViewerPanelFactory(void)
+{
+}
+
+Tizen::Ui::Controls::Panel*
+AppWidgetViewerPanelFactory::CreatePanelN(const Tizen::Base::String& panelId, const Tizen::Ui::Scenes::SceneId& sceneId)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+       Tizen::Ui::Controls::Panel* pNewPanel = null;
+
+       // TODO:
+       // Add your panel creation code here
+       return pNewPanel;
+}
diff --git a/project/src/ViewForm.cpp b/project/src/ViewForm.cpp
new file mode 100644 (file)
index 0000000..28898fb
--- /dev/null
@@ -0,0 +1,224 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2013 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 <unique_ptr.h>
+#include <FApp.h>
+#include <FMedia.h>
+#include <FShellAppWidgetView.h>
+#include <FShellAppWidgetManager.h>
+#include <FShellAppWidgetProviderInfo.h>
+#include <FShellAppWidgetSizeInfo.h>
+#include "ViewForm.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Shell;
+using namespace Tizen::Media;
+
+const int CONTEXT_MENU_X = 100;
+const int CONTEXT_MENU_Y = 200;
+const float VIEW_X = 0.0f;
+const float VIEW_Y = 50.0f;
+const float VIEW_WIDTH = 172.0f;
+const float VIEW_HEIGHT = 172.0f;
+
+ViewForm::ViewForm(void)
+       : __pAppWidgetView(null)
+       , __pContextMenu(null)
+       , __pSizeInfoList(null)
+{
+}
+
+ViewForm::~ViewForm(void)
+{
+}
+
+bool
+ViewForm::Initialize()
+{
+       Form::Construct(L"IDF_VIEW_FORM");
+
+       return true;
+}
+
+result
+ViewForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       // TODO: Add your initialization code here
+       SetFormBackEventListener(this);
+       Footer* pFooter = GetFooter();
+       pFooter->AddActionEventListener(*this);
+       return r;
+}
+
+result
+ViewForm::OnTerminating(void)
+{
+       result r = E_SUCCESS;
+
+       // TODO: Add your termination code here
+       delete __pContextMenu;
+       if (__pSizeInfoList)
+       {
+               __pSizeInfoList->RemoveAll(true);
+               delete __pSizeInfoList;
+       }
+
+       return r;
+}
+
+void
+ViewForm::CreateAppWidgetView(const Tizen::Base::String& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo)
+{
+       unique_ptr<AppWidgetView> pAppWidgetView(new AppWidgetView());
+       if (pAppWidgetView)
+       {
+               result r = pAppWidgetView->Construct(appId, providerName, FloatRectangle(VIEW_X, VIEW_Y, VIEW_WIDTH, VIEW_HEIGHT), userInfo);
+               TryReturnVoid(r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
+
+               AddControl(*pAppWidgetView);
+       }
+
+       __pAppWidgetView = pAppWidgetView.release();
+
+       __pContextMenu = new (std::nothrow) ContextMenu();
+       __pContextMenu->Construct(Point(CONTEXT_MENU_X, CONTEXT_MENU_Y), CONTEXT_MENU_STYLE_LIST);
+
+       unique_ptr<AppWidgetProviderInfo> pProviderInfo(AppWidgetManager::GetInstance()->GetAppWidgetProviderInfoN(appId, providerName ));
+       TryReturnVoid(pProviderInfo.get(), "pProviderInfo is null!!");
+
+       __pSizeInfoList = pProviderInfo->GetSizeInfoListN();
+       if (__pSizeInfoList)
+       {
+               for(int i = 0; i < __pSizeInfoList->GetCount(); i ++)
+               {
+                       AppWidgetSizeInfo* pSizeInfo = dynamic_cast<AppWidgetSizeInfo*>(__pSizeInfoList->GetAt(i) );
+                       if (!pSizeInfo)
+                       {
+                               AppLog("pSizeInfo is null");
+                               continue;
+                       }
+
+                       String size;
+                       size.Format(255, L"%dx%d", static_cast<int>(pSizeInfo->GetSize().width), static_cast<int>(pSizeInfo->GetSize().height));
+
+                       Image image;
+                       result r = image.Construct();
+//                     Bitmap* pBmp = image.DecodeN(L"/opt/apps/yPpyL2WVNQ/shared/res/screen-density-xhigh/2x2.png", BITMAP_PIXEL_FORMAT_ARGB8888);
+                       Bitmap* pBmp = image.DecodeN(pSizeInfo->GetPreviewImagePath(), BITMAP_PIXEL_FORMAT_ARGB8888);
+
+
+                       if( pBmp)
+                       {
+//                             __pContextMenu->AddItem(size, i, *pBmp );
+                               __pContextMenu->AddItem(size, i, *pBmp );
+                       }
+                       else
+                       {
+                               __pContextMenu->AddItem(size, i);
+                       }
+               }
+       }
+
+       Rectangle formBounds = GetBounds();
+       Footer* pFooter = GetFooter();
+       Rectangle footerBounds = pFooter->GetBounds();
+
+       Point anchor(formBounds.width / 2, formBounds.height - footerBounds.height);
+
+       __pContextMenu->SetAnchorPosition(anchor);
+       __pContextMenu->AddActionEventListener(*this);
+}
+
+void
+ViewForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+       AppLog("(%d)", actionId);
+
+       if (actionId == ID_FOOTER_ITEM1)
+       {
+               if (__pContextMenu && (__pContextMenu->GetItemCount() > 0))
+               {
+                       __pContextMenu->SetShowState(true);
+                       __pContextMenu->Show();
+               }
+       }
+       else
+       {
+               AppWidgetSizeInfo* pSizeInfo = null;
+               if (__pSizeInfoList)
+               {
+                       pSizeInfo = dynamic_cast<AppWidgetSizeInfo*>(__pSizeInfoList->GetAt(actionId) );
+                       TryReturnVoid(pSizeInfo, "pSizeInfo is null!!");
+               }
+               
+               if (__pAppWidgetView)
+               {
+                       __pAppWidgetView->SetSize(pSizeInfo->GetSize());
+               }
+       }
+}
+
+void
+ViewForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+       pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
+}
+
+void
+ViewForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+       if (pArgs && (pArgs->GetCount() > 0))
+       {
+               String* pAppId = dynamic_cast<String*>(pArgs->GetAt(0));
+               String* pAppWidgetProviderName = dynamic_cast<String*>(pArgs->GetAt(1));
+               String* pDisplayName = dynamic_cast<String*>(pArgs->GetAt(2));
+               String* pUserInfo = dynamic_cast<String*>(pArgs->GetAt(3));
+               if (pAppId != null && pAppWidgetProviderName != null)
+               {
+                       AppLog("%ls", pAppId->GetPointer());
+
+                       Header* pHeader = GetHeader();
+                       pHeader->SetTitleText(*pDisplayName);
+
+                       CreateAppWidgetView(*pAppId, *pAppWidgetProviderName, *pUserInfo);
+               }
+               
+               pArgs->RemoveAll(true);
+               delete pArgs;
+       }
+}
+
+void
+ViewForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
+{
+       if (__pAppWidgetView)
+       {
+               RemoveControl(*__pAppWidgetView);
+               __pAppWidgetView = null;
+       }
+}
+
diff --git a/sample.xml b/sample.xml
new file mode 100644 (file)
index 0000000..d3c61d2
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template>
+                
+       <slp-property>
+               <property-group>
+                       <sample-name>AppWidgetViewer</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>
diff --git a/screenshot.png b/screenshot.png
new file mode 100644 (file)
index 0000000..bf1fb2c
Binary files /dev/null and b/screenshot.png differ