Skip to content

Commit

Permalink
Update widget and widget application
Browse files Browse the repository at this point in the history
Here are some changes:
1, Add LowBatterySignal and LowMemorySignal into WidgetApplication
2, Add GetRegion and GetLanguage apis into WidgetApplication
3, Update widge

Change-Id: Ibf5bf5d9723be33deb3683888ac72de69552290a
  • Loading branch information
elishateng committed Oct 17, 2017
1 parent db87f59 commit 1ccef2f
Show file tree
Hide file tree
Showing 13 changed files with 767 additions and 446 deletions.
253 changes: 142 additions & 111 deletions src/Tizen.NUI/src/internal/ManualPINVOKE.cs

Large diffs are not rendered by default.

35 changes: 23 additions & 12 deletions src/Tizen.NUI/src/internal/WidgetApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,34 @@ public void Quit()
}

/// <summary>
/// Get window.
/// Get path application resources are stored at.
/// </summary>
/// <returns> The window for widget instance.</returns>
public Window GetWindow()
/// <returns>The full path of the resources</returns>
public static string GetResourcePath()
{
Window ret = new Window(NDalicManualPINVOKE.WidgetApplication_GetWindow(swigCPtr), true);
string ret = NDalicManualPINVOKE.WidgetApplication_GetResourcePath();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}

/// <summary>
/// Get path application resources are stored at.
/// Get region information from device.
/// </summary>
/// <returns>The full path of the resources</returns>
public static string GetResourcePath()
/// <returns>Region information</returns>
public string GetRegion()
{
string ret = NDalicManualPINVOKE.WidgetApplication_GetResourcePath();
string ret = NDalicManualPINVOKE.WidgetApplication_GetRegion(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}

/// <summary>
/// Get language from device.
/// </summary>
/// <returns>Language information</returns>
public string GetLanguage()
{
string ret = NDalicManualPINVOKE.WidgetApplication_GetLanguage(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
Expand Down Expand Up @@ -462,9 +473,9 @@ private void OnBatteryLow(IntPtr widgetApplication)
}
}

internal AppSignalType BatteryLowSignal()
internal WidgetApplicationLowBatterySignalType BatteryLowSignal()
{
AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_BatteryLowSignal(swigCPtr), false);
WidgetApplicationLowBatterySignalType ret = new WidgetApplicationLowBatterySignalType(NDalicManualPINVOKE.WidgetApplication_LowBatterySignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
Expand Down Expand Up @@ -516,9 +527,9 @@ private void OnMemoryLow(IntPtr widgetApplication)
}
}

internal AppSignalType MemoryLowSignal()
internal WidgetApplicationLowMemorySignalType MemoryLowSignal()
{
AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_MemoryLowSignal(swigCPtr), false);
WidgetApplicationLowMemorySignalType ret = new WidgetApplicationLowMemorySignalType(NDalicManualPINVOKE.WidgetApplication_LowMemorySignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(c) 2017 Samsung Electronics Co., Ltd.
* Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,31 +14,46 @@
* limitations under the License.
*
*/

namespace Tizen.NUI
{

internal class WidgetInstanceTerminateSignalType : global::System.IDisposable
/// <summary>
/// LowBatterySignalType.
/// </summary>
internal class WidgetApplicationLowBatterySignalType : global::System.IDisposable
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;

/// <summary>
/// swigCMemOwn.
/// </summary>
protected bool swigCMemOwn;

internal WidgetInstanceTerminateSignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
internal WidgetApplicationLowBatterySignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
{
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}

internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetInstanceTerminateSignalType obj)
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetApplicationLowBatterySignalType obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}

//A Flag to check who called Dispose(). (By User or DisposeQueue)
private bool isDisposeQueued = false;
//A Flat to check if it is already disposed.

/// <summary>
/// A Flat to check if it is already disposed.
/// </summary>
protected bool disposed = false;

~WidgetInstanceTerminateSignalType()

/// <summary>
/// Distructor.
/// </summary>
~WidgetApplicationLowBatterySignalType()
{
if (!isDisposeQueued)
{
Expand All @@ -47,6 +62,9 @@ internal WidgetInstanceTerminateSignalType(global::System.IntPtr cPtr, bool cMem
}
}

/// <summary>
/// Dispose.
/// </summary>
public void Dispose()
{
//Throw excpetion if Dispose() is called in separate thread.
Expand All @@ -66,6 +84,11 @@ public void Dispose()
}
}

/// <summary>
/// you can override it to clean-up your own resources.
/// </summary>
/// <param name="type">DisposeTypes</param>
/// <since_tizen> 3 </since_tizen>
protected virtual void Dispose(DisposeTypes type)
{
if (disposed)
Expand All @@ -87,57 +110,79 @@ protected virtual void Dispose(DisposeTypes type)

if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
swigCMemOwn = false;
NDalicManualPINVOKE.delete_WidgetInstanceTerminateSignalType(swigCPtr);
if (swigCMemOwn)
{
swigCMemOwn = false;
NDalicManualPINVOKE.WidgetApplication_delete_LowBatterySignalType(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}

disposed = true;
}

/// <summary>
/// Empty
/// </summary>
/// <returns>true if there is no signal attached</returns>
public bool Empty()
{
bool ret = NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_Empty(swigCPtr);
bool ret = NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_Empty(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}

/// <summary>
/// GetConnectionCount
/// </summary>
/// <returns>number of attached signals</returns>
public uint GetConnectionCount()
{
uint ret = NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_GetConnectionCount(swigCPtr);
uint ret = NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_GetConnectionCount(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}

/// <summary>
/// signal connect
/// </summary>
/// <param name="func"></param>
public void Connect(System.Delegate func)
{
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
{
NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}

/// <summary>
/// signal disconnect
/// </summary>
/// <param name="func"></param>
public void Disconnect(System.Delegate func)
{
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
{
NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}

public void Emit(WidgetData arg1, SWIGTYPE_p_bundle arg2, Widget.WidgetTerminateType arg3)
internal void Emit(Application.BatteryStatus arg)
{
NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_Emit(swigCPtr, WidgetData.getCPtr(arg1), SWIGTYPE_p_bundle.getCPtr(arg2), (int)arg3);
NDalicManualPINVOKE.WidgetApplication_LowBatterySignalType_Emit(swigCPtr, (int)arg);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

public WidgetInstanceTerminateSignalType() : this(NDalicManualPINVOKE.new_WidgetInstanceTerminateSignalType(), true)
/// <summary>
/// LowBatterySignalType
/// </summary>
public WidgetApplicationLowBatterySignalType() : this(NDalicManualPINVOKE.WidgetApplication_new_LowBatterySignalType(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

}

}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(c) 2017 Samsung Electronics Co., Ltd.
* Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,22 +14,22 @@
* limitations under the License.
*
*/

namespace Tizen.NUI
{

internal class WidgetInstancePauseOrResumeSignalType : global::System.IDisposable
internal class WidgetApplicationLowMemorySignalType : global::System.IDisposable
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;

internal WidgetInstancePauseOrResumeSignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
internal WidgetApplicationLowMemorySignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
{
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}

internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetInstancePauseOrResumeSignalType obj)
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetApplicationLowMemorySignalType obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
Expand All @@ -39,7 +39,7 @@ internal WidgetInstancePauseOrResumeSignalType(global::System.IntPtr cPtr, bool
//A Flat to check if it is already disposed.
protected bool disposed = false;

~WidgetInstancePauseOrResumeSignalType()
~WidgetApplicationLowMemorySignalType()
{
if (!isDisposeQueued)
{
Expand Down Expand Up @@ -88,24 +88,26 @@ protected virtual void Dispose(DisposeTypes type)

if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
swigCMemOwn = false;
NDalicManualPINVOKE.delete_WidgetInstancePauseOrResumeSignalType(swigCPtr);
if (swigCMemOwn)
{
swigCMemOwn = false;
NDalicManualPINVOKE.WidgetApplication_delete_LowMemorySignalType(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}

disposed = true;
}

public bool Empty()
{
bool ret = NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_Empty(swigCPtr);
bool ret = NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_Empty(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}

public uint GetConnectionCount()
{
uint ret = NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_GetConnectionCount(swigCPtr);
uint ret = NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_GetConnectionCount(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
Expand All @@ -114,7 +116,7 @@ public void Connect(System.Delegate func)
{
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
{
NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
Expand All @@ -123,18 +125,18 @@ public void Disconnect(System.Delegate func)
{
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
{
NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}

public void Emit(WidgetData arg)
internal void Emit(Application.MemoryStatus arg)
{
NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_Emit(swigCPtr, WidgetData.getCPtr(arg));
NDalicManualPINVOKE.WidgetApplication_LowMemorySignalType_Emit(swigCPtr, (int)arg);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

public WidgetInstancePauseOrResumeSignalType() : this(NDalicManualPINVOKE.new_WidgetInstancePauseOrResumeSignalType(), true)
public WidgetApplicationLowMemorySignalType() : this(NDalicManualPINVOKE.WidgetApplication_new_LowMemorySignalType(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
Expand Down
Loading

0 comments on commit 1ccef2f

Please sign in to comment.