/** 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.
*
*/
// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
//------------------------------------------------------------------------------
//
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 3.0.9
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
namespace Tizen.NUI
{
using System;
using System.Runtime.InteropServices;
using Tizen.NUI.BaseComponents;
///
/// The window class is used internally for drawing.
/// A Window has an orientation and indicator properties.
///
public class Window : BaseHandle
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private global::System.Runtime.InteropServices.HandleRef stageCPtr;
internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
///
/// To make Window instance be disposed.
///
public override void Dispose()
{
if (!Window.IsInstalled())
{
DisposeQueue.Instance.Add(this);
return;
}
lock (this)
{
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
{
swigCMemOwn = false;
NDalicPINVOKE.delete_Window(swigCPtr);
NDalicPINVOKE.delete_Stage(stageCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
global::System.GC.SuppressFinalize(this);
base.Dispose();
}
}
internal static Window GetCurrent()
{
Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal static bool IsInstalled()
{
bool ret = NDalicPINVOKE.Stage_IsInstalled();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Sets the focus acceptable flag of an window as true.
///
public void SetAcceptFocus(bool accept)
{
NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Retrieves whether the window is focus acceptable or not.
///
public bool IsFocusAcceptable()
{
return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Shows the window if it is hidden.
///
public void Show()
{
NDalicPINVOKE.Show(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Hides the window if it is showing.
///
public void Hide()
{
NDalicPINVOKE.Hide(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Retrieves whether the window is visible or not.
///
/// true, if the windoe is visible
public bool IsVisible()
{
bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return temp;
}
///
/// Gets the count of supported auxiliary hints of the window.
///
/// The number of supported auxiliary hints.
public uint GetSupportedAuxiliaryHintCount() {
uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets the supported auxiliary hint string of the window.
///
/// The index of the supported auxiliary hint lists.
/// The auxiliary hint string of the index.
public string GetSupportedAuxiliaryHint(uint index) {
string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Creates an auxiliary hint of the window.
///
/// The auxiliary hint string.
/// The value string.
/// The ID of created auxiliary hint, or 0 on failure.
public uint AddAuxiliaryHint(string hint, string value) {
uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Removes an auxiliary hint of the window.
///
/// The ID of the auxiliary hint.
/// True if no error occurred, false otherwise.
public bool RemoveAuxiliaryHint(uint id) {
bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Changes a value of the auxiliary hint.
///
/// The auxiliary hint ID.
/// The value string to be set.
/// True if no error occurred, false otherwise.
public bool SetAuxiliaryHintValue(uint id, string value) {
bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets a value of the auxiliary hint.
///
/// The auxiliary hint ID.
/// The string value of the auxiliary hint ID, or an empty string if none exists.
public string GetAuxiliaryHintValue(uint id) {
string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets an ID of the auxiliary hint string.
///
/// The auxiliary hint string.
/// The ID of auxiliary hint string, or 0 on failure.
public uint GetAuxiliaryHintId(string hint) {
uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Sets a region to accept input events.
///
/// The region to accept input events.
public void SetInputRegion(Rectangle inputRegion) {
NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Gets/Sets a window type.
///
public WindowType Type
{
get
{
WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
set
{
NDalicPINVOKE.SetType(swigCPtr, (int)value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
///
/// Sets a priority level for the specified notification window.
///
/// The notification window level.
/// True if no error occurred, false otherwise.
public bool SetNotificationLevel(NotificationLevel level) {
bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets a priority level for the specified notification window.
///
/// The notification window level.
public NotificationLevel GetNotificationLevel() {
NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Sets a transparent window's visual state to opaque.
///
/// Whether the window's visual state is opaque.
public void SetOpaqueState(bool opaque) {
NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Returns whether a transparent window's visual state is opaque or not.
///
/// True if the window's visual state is opaque, false otherwise.
public bool IsOpaqueState() {
bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Sets a window's screen mode.
///
/// The screen mode.
/// True if no error occurred, false otherwise.
public bool SetScreenMode(ScreenMode screenMode) {
bool ret = NDalicPINVOKE.SetScreenMode(swigCPtr, (int)screenMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets a screen mode of the window.
///
/// The screen mode.
public ScreenMode GetScreenMode() {
ScreenMode ret = (ScreenMode)NDalicPINVOKE.GetScreenMode(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Sets preferred brightness of the window.
///
/// The preferred brightness (0 to 100).
/// True if no error occurred, false otherwise.
public bool SetBrightness(int brightness) {
bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets preffered brightness of the window.
///
/// The preffered brightness.
public int GetBrightness() {
int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public class WindowFocusChangedEventArgs : EventArgs
{
public bool FocusGained
{
get;
set;
}
}
private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
private event EventHandler _windowFocusChangedEventHandler;
public event EventHandler WindowFocusChanged
{
add
{
if (_windowFocusChangedEventHandler == null)
{
_windowFocusChangedEventCallback = OnWindowFocusedChanged;
WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
}
_windowFocusChangedEventHandler += value;
}
remove
{
_windowFocusChangedEventHandler -= value;
if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
{
WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
}
}
}
private void OnWindowFocusedChanged(bool focusGained)
{
WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
e.FocusGained = focusGained;
if (_windowFocusChangedEventHandler != null)
{
_windowFocusChangedEventHandler(this, e);
}
}
internal WindowFocusSignalType WindowFocusChangedSignal()
{
WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Creates an initialized handle to a new Window.
///
/// The position and size of the Window
/// The Window title
/// Whether Window is transparent
public Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Creates an initialized handle to a new Window.
///
/// The position and size of the Window
/// The Window title
public Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Creates an initialized handle to a new Window.
///
/// The position and size of the Window
/// The Window title
/// The Window class name
/// Whether Window is transparent
public Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Creates an initialized handle to a new Window.
///
/// The position and size of the Window
/// The Window title
/// The Window class name
public Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal Window(Window handle) : this(NDalicPINVOKE.new_Window__SWIG_1(Window.getCPtr(handle)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal Window Assign(Window rhs)
{
Window ret = new Window(NDalicPINVOKE.Window_Assign(swigCPtr, Window.getCPtr(rhs)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// This sets whether the indicator bar should be shown or not.
///
/// Visible mode for indicator bar, Visible in default
internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
{
NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// This sets the opacity mode of indicator bar.
///
/// The opacity mode
internal void SetIndicatorBgOpacity(Window.IndicatorBgOpacity opacity)
{
NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// This sets the orientation of indicator bar.
/// It does not implicitly show the indicator if it is currently hidden.
///
/// The orientation
internal void RotateIndicator(Window.WindowOrientation orientation)
{
NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void SetClass(string name, string klass)
{
NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Raises window to the top of Window stack.
///
public void Raise()
{
NDalicPINVOKE.Window_Raise(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Lowers window to the bottom of Window stack.
///
public void Lower()
{
NDalicPINVOKE.Window_Lower(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Activates window to the top of Window stack even it is iconified.
///
public void Activate()
{
NDalicPINVOKE.Window_Activate(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void AddAvailableOrientation(Window.WindowOrientation orientation)
{
NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
{
NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void SetPreferredOrientation(Window.WindowOrientation orientation)
{
NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal Window.WindowOrientation GetPreferredOrientation()
{
Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal DragAndDropDetector GetDragAndDropDetector()
{
DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal Any GetNativeHandle()
{
Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal WindowFocusSignalType FocusChangedSignal()
{
WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Get default ( root ) layer.
///
/// The root layer
public Layer GetDefaultLayer()
{
return this.GetRootLayer();
}
///
/// Add layer to the Stage.
///
/// Layer to add
public void AddLayer(Layer layer)
{
NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Remove layer from the Stage.
///
/// Layer to remove
public void RemoveLayer(Layer layer)
{
NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void Add(View view)
{
NDalicPINVOKE.Stage_Add(stageCPtr, View.getCPtr(view));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void Remove(View view)
{
NDalicPINVOKE.Stage_Remove(stageCPtr, View.getCPtr(view));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal Vector2 GetSize()
{
Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal RenderTaskList GetRenderTaskList()
{
RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Queries the number of on-window layers.
///
/// The number of layers.
/// Note that a default layer is always provided (count >= 1).
public uint GetLayerCount()
{
uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Layer GetLayer(uint depth)
{
Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal Layer GetRootLayer()
{
Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal void SetBackgroundColor(Vector4 color)
{
NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal Vector4 GetBackgroundColor()
{
Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal Vector2 GetDpi()
{
Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ObjectRegistry GetObjectRegistry()
{
ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Keep rendering for at least the given amount of time.
///
/// Time to keep rendering, 0 means render at least one more frame
public void KeepRendering(float durationSeconds)
{
NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal KeyEventSignal KeyEventSignal()
{
KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal VoidSignal EventProcessingFinishedSignal()
{
VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal TouchSignal TouchSignal()
{
TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private StageWheelSignal WheelEventSignal()
{
StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal VoidSignal ContextLostSignal()
{
VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal VoidSignal ContextRegainedSignal()
{
VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal VoidSignal SceneCreatedSignal()
{
VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal static Vector4 DEFAULT_BACKGROUND_COLOR
{
get
{
global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
internal static Vector4 DEBUG_BACKGROUND_COLOR
{
get
{
global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
private static readonly Window instance = Application.Instance.GetWindow();
///
/// Stage instance property (read-only).
/// Gets the current Window.
///
public static Window Instance
{
get
{
return instance;
}
}
///
/// Grabs the key specified by a key for a window only when a window is the topmost window.
/// This function can be used for following example scenarios:
/// - Mobile - Using volume up/down as zoom up/down in camera apps.
///
/// The key code to grab
/// true if the grab succeeds
public bool GrabKeyTopmost(int DaliKey)
{
bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Ungrabs the key specified by a key for a window.
/// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event.
///
/// The key code to ungrab
/// true if the ungrab succeeds
public bool UngrabKeyTopmost(int DaliKey)
{
bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Grabs the key specified by a key for a window in a GrabMode.
/// Details: This function can be used for following example scenarios:
/// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app.
/// - Mobile - When a user presses Home key, the homescreen appears regardless of current foreground app.
/// - Mobile - Using volume up/down as zoom up/down in camera apps.
///
/// The key code to grab
/// The grab mode for the key
/// true if the grab succeeds
public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
{
bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Ungrabs the key specified by a key for a window.
/// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event.
///
/// The key code to ungrab
/// true if the ungrab succeeds
public bool UngrabKey(int DaliKey)
{
bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal System.IntPtr GetNativeWindowHandler()
{
System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
///
public enum WindowOrientation
{
Portrait = 0,
Landscape = 90,
PortraitInverse = 180,
LandscapeInverse = 270
}
///
/// Enumeration for key grab mode for platform-level APIs.
///
public enum KeyGrabMode
{
///
/// Grab a key only when on the top of the grabbing-window stack mode.
///
Topmost = 0,
///
/// Grab a key together with the other client window(s) mode.
///
Shared,
///
/// Grab a key exclusively regardless of the grabbing-window's position on the window stack with the possibility of overriding the grab by the other client window mode.
///
OverrideExclusive,
///
/// Grab a key exclusively regardless of the grabbing-window's position on the window stack mode.
///
Exclusive
};
///
/// Enumeration for opacity of the indicator.
///
internal enum IndicatorBgOpacity
{
Opaque = 100,
Translucent = 50,
Transparent = 0
}
///
/// Enumeration for visible mode of the indicator.
///
internal enum IndicatorVisibleMode
{
Invisible = 0,
Visible = 1,
Auto = 2
}
///
/// Touch event argument.
///
public class TouchEventArgs : EventArgs
{
private Touch _touch;
///
/// Touch.
///
public Touch Touch
{
get
{
return _touch;
}
set
{
_touch = value;
}
}
}
private event EventHandler _stageTouchHandler;
private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
///
/// This is emitted when the screen is touched and when the touch ends.
/// If there are multiple touch points, then this will be emitted when the first touch occurs and
/// then when the last finger is lifted.
/// An interrupted event will also be emitted (if it occurs).
///
public event EventHandler TouchEvent
{
add
{
lock (this)
{
_stageTouchHandler += value;
_stageTouchCallbackDelegate = OnStageTouch;
this.TouchSignal().Connect(_stageTouchCallbackDelegate);
}
}
remove
{
lock (this)
{
if (_stageTouchHandler != null)
{
this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
}
_stageTouchHandler -= value;
}
}
}
private void OnStageTouch(IntPtr data)
{
TouchEventArgs e = new TouchEventArgs();
if (data != null)
{
e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
}
if (_stageTouchHandler != null)
{
_stageTouchHandler(this, e);
}
}
///
/// Wheel event arguments.
///
public class WheelEventArgs : EventArgs
{
private Wheel _wheel;
///
/// Wheel.
///
public Wheel Wheel
{
get
{
return _wheel;
}
set
{
_wheel = value;
}
}
}
private event EventHandler _stageWheelHandler;
private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
///
/// Event emitted when wheel event is received.
///
public event EventHandler WheelEvent
{
add
{
if (_stageWheelHandler == null)
{
_stageWheelCallbackDelegate = OnStageWheel;
WheelEventSignal().Connect(_stageWheelCallbackDelegate);
}
_stageWheelHandler += value;
}
remove
{
_stageWheelHandler -= value;
if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
{
WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
}
}
}
private void OnStageWheel(IntPtr data)
{
WheelEventArgs e = new WheelEventArgs();
if (data != null)
{
e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
}
if (_stageWheelHandler != null)
{
_stageWheelHandler(this, e);
}
}
///
/// Key event arguments.
///
public class KeyEventArgs : EventArgs
{
private Key _key;
///
/// Key
///
public Key Key
{
get
{
return _key;
}
set
{
_key = value;
}
}
}
private event EventHandler _stageKeyHandler;
private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
///
/// Event emitted when key event is received.
///
public event EventHandler KeyEvent
{
add
{
if (_stageKeyHandler == null)
{
_stageKeyCallbackDelegate = OnStageKey;
KeyEventSignal().Connect(_stageKeyCallbackDelegate);
}
_stageKeyHandler += value;
}
remove
{
_stageKeyHandler -= value;
if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
{
KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
}
}
}
// Callback for Stage KeyEventsignal
private void OnStageKey(IntPtr data)
{
KeyEventArgs e = new KeyEventArgs();
if (data != null)
{
e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
}
if (_stageKeyHandler != null)
{
//here we send all data to user event handlers
_stageKeyHandler(this, e);
}
}
private event EventHandler _stageEventProcessingFinishedEventHandler;
private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
internal event EventHandler EventProcessingFinished
{
add
{
if (_stageEventProcessingFinishedEventHandler == null)
{
_stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
}
_stageEventProcessingFinishedEventHandler += value;
}
remove
{
_stageEventProcessingFinishedEventHandler -= value;
if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
{
EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
}
}
}
// Callback for Stage EventProcessingFinishedSignal
private void OnEventProcessingFinished()
{
if (_stageEventProcessingFinishedEventHandler != null)
{
_stageEventProcessingFinishedEventHandler(this, null);
}
}
private EventHandler _stageContextLostEventHandler;
private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
internal event EventHandler ContextLost
{
add
{
if (_stageContextLostEventHandler == null)
{
_stageContextLostEventCallbackDelegate = OnContextLost;
ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
}
_stageContextLostEventHandler += value;
}
remove
{
_stageContextLostEventHandler -= value;
if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
{
ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
}
}
}
// Callback for Stage ContextLostSignal
private void OnContextLost()
{
if (_stageContextLostEventHandler != null)
{
_stageContextLostEventHandler(this, null);
}
}
private EventHandler _stageContextRegainedEventHandler;
private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
internal event EventHandler ContextRegained
{
add
{
if (_stageContextRegainedEventHandler == null)
{
_stageContextRegainedEventCallbackDelegate = OnContextRegained;
ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
}
_stageContextRegainedEventHandler += value;
}
remove
{
_stageContextRegainedEventHandler -= value;
if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
{
this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
}
}
}
// Callback for Stage ContextRegainedSignal
private void OnContextRegained()
{
if (_stageContextRegainedEventHandler != null)
{
_stageContextRegainedEventHandler(this, null);
}
}
private EventHandler _stageSceneCreatedEventHandler;
private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
internal event EventHandler SceneCreated
{
add
{
if (_stageSceneCreatedEventHandler == null)
{
_stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
}
_stageSceneCreatedEventHandler += value;
}
remove
{
_stageSceneCreatedEventHandler -= value;
if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
{
SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
}
}
}
// Callback for Stage SceneCreatedSignal
private void OnSceneCreated()
{
if (_stageSceneCreatedEventHandler != null)
{
_stageSceneCreatedEventHandler(this, null);
}
}
///
/// Window size property (read-only).
///
public Vector2 Size
{
get
{
Vector2 ret = GetSize();
return ret;
}
}
///
/// Background color property.
///
public Vector4 BackgroundColor
{
set
{
SetBackgroundColor(value);
}
get
{
Vector4 ret = GetBackgroundColor();
return ret;
}
}
///
/// Dpi property (read-only).
/// Retrieves the DPI of the display device to which the Window is connected.
///
public Vector2 Dpi
{
get
{
return GetDpi();
}
}
///
/// Layer count property (read-only).
/// Queries the number of on-Window layers.
///
public uint LayerCount
{
get
{
return GetLayerCount();
}
}
}
}