/*
* 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.
* 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 System;
using System.Runtime.InteropServices;
namespace Tizen.NUI
{
///
/// Widget application
///
internal class WidgetApplication : BaseHandle
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal WidgetApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetApplication_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetApplication obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
///
/// To make Window instance be disposed.
///
protected override void Dispose(DisposeTypes type)
{
if(disposed)
{
return;
}
if(type == DisposeTypes.Explicit)
{
//Called by User
//Release your own managed resources here.
//You should release all of your own disposable objects here.
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
if (_initCallback != null)
{
this.InitSignal().Disconnect(_initCallback);
}
if (_terminateCallback != null)
{
this.TerminateSignal().Disconnect(_terminateCallback);
}
if (_languageChangedCallback != null)
{
this.LanguageChangedSignal().Disconnect(_languageChangedCallback);;
}
if (_regionChangedCallback != null)
{
this.RegionChangedSignal().Disconnect(_regionChangedCallback);
}
if (_batteryLowCallback != null)
{
this.BatteryLowSignal().Disconnect(_batteryLowCallback);
}
if (_memoryLowCallback != null)
{
this.MemoryLowSignal().Disconnect(_memoryLowCallback);
}
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
{
swigCMemOwn = false;
NDalicManualPINVOKE.delete_WidgetApplication(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
base.Dispose(type);
}
internal static WidgetApplication GetWidgetApplicationFromPtr(global::System.IntPtr cPtr)
{
WidgetApplication ret = new WidgetApplication(cPtr, false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static WidgetApplication Instance
{
get
{
return _instance;
}
}
public static WidgetApplication NewWidgetApplication(string[] args, string stylesheet)
{
WidgetApplication ret = New(args, stylesheet);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
_instance = ret;
return ret;
}
public static WidgetApplication New(string[] args, string stylesheet)
{
int argc = args.Length;
string argvStr = string.Join(" ", args);
WidgetApplication ret = new WidgetApplication(NDalicManualPINVOKE.WidgetApplication_New(argc, argvStr, stylesheet), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal WidgetApplication(WidgetApplication widgetApplication) : this(NDalicManualPINVOKE.new_WidgetApplication__SWIG_1(WidgetApplication.getCPtr(widgetApplication)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal WidgetApplication Assign(WidgetApplication widgetApplication)
{
WidgetApplication ret = new WidgetApplication(NDalicManualPINVOKE.WidgetApplication_Assign(swigCPtr, WidgetApplication.getCPtr(widgetApplication)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// This starts the application.
///
public void MainLoop()
{
NDalicManualPINVOKE.WidgetApplication_MainLoop(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending)
{
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
///
/// This quits the application.
/// Tizen applications should use Lower to improve re-start performance unless they need to Quit completely.
///
public void Quit()
{
NDalicManualPINVOKE.WidgetApplication_Quit(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Get path application resources are stored at.
///
/// The full path of the resources
public static string GetResourcePath()
{
string ret = NDalicManualPINVOKE.WidgetApplication_GetResourcePath();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Get region information from device.
///
/// Region information
public string GetRegion()
{
string ret = NDalicManualPINVOKE.WidgetApplication_GetRegion(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Get language from device.
///
/// Language information
public string GetLanguage()
{
string ret = NDalicManualPINVOKE.WidgetApplication_GetLanguage(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Event arguments that passed via widget app event signal.
///
/// 4
public class WidgetApplicationEventArgs : EventArgs
{
///
/// Widget application.
///
/// 4
public WidgetApplication WidgetApplication
{
get;
set;
}
}
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void InitCallbackType(IntPtr widgetApplication);
private InitCallbackType _initCallback;
private DaliEventHandler