Add property 'Window' in WidgetBase
authorJunghoon Park <jh9216.park@samsung.com>
Thu, 12 Jan 2017 08:50:57 +0000 (17:50 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Thu, 12 Jan 2017 10:04:05 +0000 (19:04 +0900)
- Make WidgetWindow class for making property 'Window'
- It is dependent on ElmSharp
- Property 'Window' will be prepared after OnCreate method is invoked

Change-Id: I70fe316fdcc6bea438d85b973ef8766f1af3f882
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
packaging/csapi-widget-application.spec
src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.Net45.csproj [changed mode: 0644->0755]
src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.Net45.project.json
src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.csproj
src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.nuspec
src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.project.json
src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetBase.cs [changed mode: 0644->0755]
src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetWindow.cs [new file with mode: 0755]

index 82db422..e3d2103 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       csapi-widget-application
 Summary:    Tizen widget application API for C#
-Version:    1.0.2
+Version:    1.0.3
 Release:    1
 Group:      Development/Libraries
 License:    Apache-2.0
@@ -16,6 +16,7 @@ BuildRequires: dotnet-build-tools
 # C# API Requires
 BuildRequires: csapi-tizen-nuget
 BuildRequires: csapi-application-nuget
+BuildRequires: elm-sharp-nuget
 
 %define Assemblies Tizen.Applications.WidgetApplication
 
old mode 100644 (file)
new mode 100755 (executable)
index 11d9dde..92e4bdf
     <Compile Include="Tizen.Applications\WidgetBase.cs" />\r
     <Compile Include="Tizen.Applications.CoreBackend\WidgetCoreBackend.cs" />\r
     <Compile Include="Tizen.Applications\WidgetType.cs" />\r
+    <Compile Include="Tizen.Applications\WidgetWindow.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="Tizen.Applications.WidgetApplication.Net45.project.json" />\r
     <None Include="Tizen.Applications.WidgetApplication.nuspec" />\r
     <None Include="Tizen.Applications.WidgetApplication.snk" />\r
   </ItemGroup>\r
-  <ItemGroup>\r
-    <CodeAnalysisDictionary Include="CustomDictionary.xml" />\r
-  </ItemGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
        Other similar extension points exist, see Microsoft.Common.targets.\r
@@ -74,4 +72,4 @@
   <Target Name="AfterBuild">\r
   </Target>\r
   -->\r
-</Project>\r
+</Project>
\ No newline at end of file
index 0d26dd7..83c6b14 100755 (executable)
@@ -1,7 +1,8 @@
 {
   "dependencies": {
     "Tizen": "1.0.2",
-    "Tizen.Applications": "1.0.2"
+    "Tizen.Applications": "1.0.3",
+    "ElmSharp": "1.1.0-*"
   },
   "frameworks": {
     "net45": {}
index eea3321..6b4f3c4 100755 (executable)
@@ -57,6 +57,7 @@
     <Compile Include="Tizen.Applications\WidgetBase.cs" />\r
     <Compile Include="Tizen.Applications.CoreBackend\WidgetCoreBackend.cs" />\r
     <Compile Include="Tizen.Applications\WidgetType.cs" />\r
+    <Compile Include="Tizen.Applications\WidgetWindow.cs" />\r
   </ItemGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
@@ -78,4 +79,4 @@
     <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>\r
     <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>\r
   </PropertyGroup>\r
-</Project>\r
+</Project>
\ No newline at end of file
index 18213f3..f787f07 100755 (executable)
@@ -13,6 +13,7 @@
                <dependencies>
                        <dependency id="Tizen" version="1.0.2" />
                        <dependency id="Tizen.Applications" version="1.0.2" />
+                       <dependency id="ElmSharp" version="1.0.14" />
                </dependencies>
        </metadata>
        <files>
index 1a92c9a..b958a24 100755 (executable)
@@ -1,10 +1,11 @@
-{
-  "dependencies": {
-    "NETStandard.Library": "1.6.0",
-    "Tizen": "1.0.2",
-    "Tizen.Applications": "1.0.2",
-  },
-  "frameworks": {
-    "netstandard1.3": {}
-  }
-}
+{\r
+  "dependencies": {\r
+    "NETStandard.Library": "1.6.0",\r
+    "Tizen": "1.0.2",\r
+    "Tizen.Applications": "1.0.3",\r
+    "ElmSharp": "1.1.0-*"\r
+  },\r
+  "frameworks": {\r
+    "netstandard1.3": {}\r
+  }\r
+}\r
old mode 100644 (file)
new mode 100755 (executable)
index b32cedc..1527ca0
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+using ElmSharp;
 using System;
 
 namespace Tizen.Applications
@@ -28,6 +29,12 @@ namespace Tizen.Applications
         protected static readonly string LogTag = typeof(WidgetBase).Namespace;
 
         /// <summary>
+        /// Window object for this widget instance.
+        /// It wii be created after OnCreate method is invoked.
+        /// </summary>
+        protected Widget Window;
+
+        /// <summary>
         /// Delete type
         /// </summary>
         public enum WidgetDestroyType
@@ -153,8 +160,9 @@ namespace Tizen.Applications
             IntPtr win;
 
             Interop.Widget.GetWin(Handle, out win);
-
-            OnPreCreate(win, w, h);
+            Window = new WidgetWindow(win);
+            Window.Resize(w, h);
+            Window.Show();
         }
 
         /// <summary>
@@ -198,13 +206,5 @@ namespace Tizen.Applications
         {
         }
 
-        /// <summary>
-        /// Overrides this method if want to handle behavior before OnCreate() is completed.
-        /// <param name="w">The pixel value for widget width</param>
-        /// <param name="h">The pixel value for widget height</param>
-        /// </summary>
-        protected virtual void OnPreCreate(IntPtr window, int w, int h)
-        {
-        }
     }
 }
diff --git a/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetWindow.cs b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetWindow.cs
new file mode 100755 (executable)
index 0000000..0502537
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using ElmSharp;
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Applications
+{
+    internal class WidgetWindow : Widget
+    {
+        private IntPtr _handle;
+
+        internal WidgetWindow(IntPtr handle) : base()
+        {
+            _handle = handle;
+            Realize(null);
+        }
+
+        protected override IntPtr CreateHandle(EvasObject parent)
+        {
+            return _handle;
+        }
+
+    }
+}
+