Class Window
Definition
- Assembly:
- Tizen.NUI.dll
The window class is used internally for drawing.
The window has an orientation and indicator properties.
public class Window : BaseHandle, INotifyPropertyChanged, IDisposable, IWindowProvider
- Inheritance
- Implements
-
System.ComponentModel.INotifyPropertyChangedSystem.IDisposable
Constructors
View SourceWindow(string, Rectangle, bool)
Creates a new Window with a specific name.
This creates an extra window in addition to the default main window
Declaration
public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name for extra window. |
Rectangle | windowPosition | The position and size of the Window. |
bool | isTranslucent | Whether Window is translucent. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
Window(Rectangle, bool)
Creates a new Window.
This creates an extra window in addition to the default main window
Declaration
public Window(Rectangle windowPosition = null, bool isTranslucent = false)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | windowPosition | The position and size of the Window. |
bool | isTranslucent | Whether Window is translucent. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
Properties
View SourceBackgroundColor
The background color property.
Declaration
public Color BackgroundColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
Default
Gets the default window. The main window or default window is automatically created when the application is launched, and it remains constant and unchanged throughout the application's operation.
Declaration
public static Window Default { get; }
Property Value
Type | Description |
---|---|
Window |
Dpi
The DPI property (read-only).
Retrieves the DPI of the display device to which the Window is connected.
Declaration
public Vector2 Dpi { get; }
Property Value
Type | Description |
---|---|
Vector2 |
Instance
The stage instance property (read-only).
Gets the current window.
Declaration
[Obsolete("This has been deprecated in API12, please use Default instead")]
public static Window Instance { get; }
Property Value
Type | Description |
---|---|
Window |
LayerCount
The layer count property (read-only).
Queries the number of on-Window layers.
Declaration
public uint LayerCount { get; }
Property Value
Type | Description |
---|---|
uint |
NativeHandle
Get Native Window handle.
Window window = NUIApplication.GetDefaultWindow();
var handle = window.NativeHandle;
if(handle.IsInvalid == false)
{
IntPtr nativeHandle = handle.DangerousGetHandle();
// do something with nativeHandle
}
Declaration
public SafeHandle NativeHandle { get; }
Property Value
Type | Description |
---|---|
System.Runtime.InteropServices.SafeHandle |
RenderingBehavior
The rendering behavior of a Window.
Declaration
public RenderingBehaviorType RenderingBehavior { get; set; }
Property Value
Type | Description |
---|---|
RenderingBehaviorType |
Size
The window size property (read-only).
Declaration
public Size2D Size { get; }
Property Value
Type | Description |
---|---|
Size2D |
Title
Gets/Sets a window title.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
string |
Type
Gets or sets a window type. Most of window type can be set to use WindowType, except for IME type. IME type can be set to use one of NUIApplication's constrcutors.
Declaration
public WindowType Type { get; set; }
Property Value
Type | Description |
---|---|
WindowType |
WindowPosition
Gets or sets a position of the window.
Declaration
public Position2D WindowPosition { get; set; }
Property Value
Type | Description |
---|---|
Position2D |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when value is null. |
WindowSize
Gets or sets a size of the window.
Declaration
public Size2D WindowSize { get; set; }
Property Value
Type | Description |
---|---|
Size2D |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when value is null. |
Methods
View SourceActivate()
Activates the window to the top of the window stack even it is iconified.
Declaration
public void Activate()
Add(View)
Add a child view to window.
Declaration
public void Add(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view | the child should be added to the window. |
AddAuxiliaryHint(string, string)
Creates an auxiliary hint of the window.
Declaration
public uint AddAuxiliaryHint(string hint, string value)
Parameters
Type | Name | Description |
---|---|---|
string | hint | The auxiliary hint string. |
string | value | The value string. |
Returns
Type | Description |
---|---|
uint | The ID of created auxiliary hint, or 0 on failure. |
AddAvailableOrientation(WindowOrientation)
Adds an orientation to the list of available orientations.
Declaration
public void AddAvailableOrientation(Window.WindowOrientation orientation)
Parameters
Type | Name | Description |
---|---|---|
Window.WindowOrientation | orientation | The available orientation to add |
AddLayer(Layer)
Adds a layer to the stage.
Declaration
public void AddLayer(Layer layer)
Parameters
Type | Name | Description |
---|---|---|
Layer | layer | Layer to add. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when layer is null. |
FeedKey(Key)
Feeds a key event into the window.
Declaration
public void FeedKey(Key keyEvent)
Parameters
Type | Name | Description |
---|---|---|
Key | keyEvent | The key event to feed. |
FeedKeyEvent(Key)
Feed a key-event into the window.
Declaration
[Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
public static void FeedKeyEvent(Key keyEvent)
Parameters
Type | Name | Description |
---|---|---|
Key | keyEvent | The key event to feed. |
GetAuxiliaryHintId(string)
Gets an ID of the auxiliary hint string.
Declaration
public uint GetAuxiliaryHintId(string hint)
Parameters
Type | Name | Description |
---|---|---|
string | hint | The auxiliary hint string. |
Returns
Type | Description |
---|---|
uint | The ID of auxiliary hint string, or 0 on failure. |
GetAuxiliaryHintValue(uint)
Gets a value of the auxiliary hint.
Declaration
public string GetAuxiliaryHintValue(uint id)
Parameters
Type | Name | Description |
---|---|---|
uint | id | The auxiliary hint ID. |
Returns
Type | Description |
---|---|
string | The string value of the auxiliary hint ID, or an empty string if none exists. |
GetBrightness()
Gets the preferred brightness of the window.
Declaration
public int GetBrightness()
Returns
Type | Description |
---|---|
int | The preferred brightness. |
GetDefaultLayer()
Gets the default ( root ) layer.
Declaration
public Layer GetDefaultLayer()
Returns
Type | Description |
---|---|
Layer | The root layer. |
GetKeyboardRepeatInfo(out float, out float)
Gets the keyboard repeat information.
Declaration
public bool GetKeyboardRepeatInfo(out float rate, out float delay)
Parameters
Type | Name | Description |
---|---|---|
float | rate | The key repeat rate value in seconds. |
float | delay | The key repeat delay value in seconds. |
Returns
Type | Description |
---|---|
bool | True if setting the keyboard repeat succeeds. |
GetLayer(uint)
Retrieves the layer at a specified depth.
Declaration
public Layer GetLayer(uint depth)
Parameters
Type | Name | Description |
---|---|---|
uint | depth | The layer's depth index. |
Returns
Type | Description |
---|---|
Layer | The layer found at the given depth. |
GetNotificationLevel()
Gets a priority level for the specified notification window.
Declaration
public NotificationLevel GetNotificationLevel()
Returns
Type | Description |
---|---|
NotificationLevel | The notification window level. |
GetParent()
Gets parent window of the window.
Declaration
public Window GetParent()
Returns
Type | Description |
---|---|
Window | The parent window of the window. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
GetPreferredOrientation()
Gets the preferred orientation.
Declaration
public Window.WindowOrientation GetPreferredOrientation()
Returns
Type | Description |
---|---|
Window.WindowOrientation | The preferred orientation if previously set, or none. |
GetScreenOffMode()
Gets the screen mode of the window.
Declaration
public ScreenOffMode GetScreenOffMode()
Returns
Type | Description |
---|---|
ScreenOffMode | The screen off mode. |
GetSupportedAuxiliaryHint(uint)
Gets the supported auxiliary hint string of the window.
Declaration
public string GetSupportedAuxiliaryHint(uint index)
Parameters
Type | Name | Description |
---|---|---|
uint | index | The index of the supported auxiliary hint lists. |
Returns
Type | Description |
---|---|
string | The auxiliary hint string of the index. |
GetSupportedAuxiliaryHintCount()
Gets the count of supported auxiliary hints of the window.
Declaration
public uint GetSupportedAuxiliaryHintCount()
Returns
Type | Description |
---|---|
uint | The number of supported auxiliary hints. |
GrabKey(int, KeyGrabMode)
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 the Home key, the homescreen appears regardless of the current foreground app.
- Mobile - Using the volume up or down as zoom up or down in camera apps.
Declaration
public bool GrabKey(int DaliKey, Window.KeyGrabMode GrabMode)
Parameters
Type | Name | Description |
---|---|---|
int | DaliKey | The key code to grab. |
Window.KeyGrabMode | GrabMode | The grab mode for the key. |
Returns
Type | Description |
---|---|
bool | True if the grab succeeds. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | This exception can be thrown due to permission denied. |
GrabKeyTopmost(int)
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 or down as zoom up or down in camera apps.
Declaration
public bool GrabKeyTopmost(int DaliKey)
Parameters
Type | Name | Description |
---|---|---|
int | DaliKey | The key code to grab. |
Returns
Type | Description |
---|---|
bool | True if the grab succeeds. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | This exception can be thrown due to permission denied. |
Hide()
Hides the window if it is showing.
Declaration
public void Hide()
IsFocusAcceptable()
Returns whether the window accepts a focus or not.
Declaration
public bool IsFocusAcceptable()
Returns
Type | Description |
---|---|
bool | True if the window accepts a focus, false otherwise. |
IsOpaqueState()
Returns whether a transparent window's visual state is opaque or not.
Declaration
public bool IsOpaqueState()
Returns
Type | Description |
---|---|
bool | True if the window's visual state is opaque, false otherwise. |
Remarks
The return value has no meaning on an opaque window.
IsVisible()
Retrieves whether the window is visible or not.
Declaration
public bool IsVisible()
Returns
Type | Description |
---|---|
bool | True if the window is visible. |
KeepRendering(float)
Keep rendering for at least the given amount of time.
Declaration
public void KeepRendering(float durationSeconds)
Parameters
Type | Name | Description |
---|---|---|
float | durationSeconds | Time to keep rendering, 0 means render at least one more frame. |
Lower()
Lowers the window to the bottom of the window stack.
Declaration
public void Lower()
Raise()
Raises the window to the top of the window stack.
Declaration
public void Raise()
Remove(View)
Remove a child view from window.
Declaration
public void Remove(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view | the child to be removed. |
RemoveAuxiliaryHint(uint)
Removes an auxiliary hint of the window.
Declaration
public bool RemoveAuxiliaryHint(uint id)
Parameters
Type | Name | Description |
---|---|---|
uint | id | The ID of the auxiliary hint. |
Returns
Type | Description |
---|---|
bool | True if no error occurred, false otherwise. |
RemoveAvailableOrientation(WindowOrientation)
Removes an orientation from the list of available orientations.
Declaration
public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
Parameters
Type | Name | Description |
---|---|---|
Window.WindowOrientation | orientation | The available orientation to remove. |
RemoveLayer(Layer)
Removes a layer from the stage.
Declaration
public void RemoveLayer(Layer layer)
Parameters
Type | Name | Description |
---|---|---|
Layer | layer | Layer to remove. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when layer is null. |
RenderOnce()
Allows at least one more render, even when paused. The window should be shown, not minimised.
Declaration
public void RenderOnce()
SetAcceptFocus(bool)
Sets whether the window accepts a focus or not.
Declaration
public void SetAcceptFocus(bool accept)
Parameters
Type | Name | Description |
---|---|---|
bool | accept | If a focus is accepted or not. The default is true. |
SetAuxiliaryHintValue(uint, string)
Changes a value of the auxiliary hint.
Declaration
public bool SetAuxiliaryHintValue(uint id, string value)
Parameters
Type | Name | Description |
---|---|---|
uint | id | The auxiliary hint ID. |
string | value | The value string to be set. |
Returns
Type | Description |
---|---|
bool | True if no error occurred, false otherwise. |
SetBrightness(int)
Sets preferred brightness of the window.
Declaration
public bool SetBrightness(int brightness)
Parameters
Type | Name | Description |
---|---|---|
int | brightness | The preferred brightness (0 to 100). |
Returns
Type | Description |
---|---|
bool | True if no error occurred, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | This exception can be thrown due to permission denied. |
SetClass(string, string)
Sets the window name and the class string.
Declaration
public void SetClass(string name, string klass)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the window. |
string | klass | The class of the window. |
SetInputRegion(Rectangle)
Sets a region to accept input events.
Declaration
public void SetInputRegion(Rectangle inputRegion)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | inputRegion | The region to accept input events. |
SetKeyboardRepeatInfo(float, float)
Sets the keyboard repeat information.
Declaration
public bool SetKeyboardRepeatInfo(float rate, float delay)
Parameters
Type | Name | Description |
---|---|---|
float | rate | The key repeat rate value in seconds. |
float | delay | The key repeat delay value in seconds. |
Returns
Type | Description |
---|---|
bool | True if setting the keyboard repeat succeeds. |
SetNotificationLevel(NotificationLevel)
Sets a priority level for the specified notification window.
Declaration
public bool SetNotificationLevel(NotificationLevel level)
Parameters
Type | Name | Description |
---|---|---|
NotificationLevel | level | The notification window level. |
Returns
Type | Description |
---|---|
bool | True if no error occurred, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | This exception can be thrown due to permission denied. |
SetOpaqueState(bool)
Sets a transparent window's visual state to opaque.
If a visual state of a transparent window is opaque,
then the window manager could handle it as an opaque window when calculating visibility.
Declaration
public void SetOpaqueState(bool opaque)
Parameters
Type | Name | Description |
---|---|---|
bool | opaque | Whether the window's visual state is opaque. |
Remarks
This will have no effect on an opaque window.
It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
SetParent(Window)
Sets parent window of the window. After setting that, these windows do together when raise-up, lower and iconified/deiconified. Initially, the window is located on top of the parent. The window can go below parent by calling Lower(). If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
Declaration
public void SetParent(Window parent)
Parameters
Type | Name | Description |
---|---|---|
Window | parent | The parent window. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
SetPreferredOrientation(WindowOrientation)
Sets a preferred orientation.
Declaration
public void SetPreferredOrientation(Window.WindowOrientation orientation)
Parameters
Type | Name | Description |
---|---|---|
Window.WindowOrientation | orientation | The preferred orientation. |
SetScreenOffMode(ScreenOffMode)
Sets a window's screen off mode.
Declaration
public bool SetScreenOffMode(ScreenOffMode screenOffMode)
Parameters
Type | Name | Description |
---|---|---|
ScreenOffMode | screenOffMode | The screen mode. |
Returns
Type | Description |
---|---|
bool | True if no error occurred, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | This exception can be thrown due to permission denied. |
SetTransparency(bool)
Sets whether the window is transparent or not.
Declaration
public void SetTransparency(bool transparent)
Parameters
Type | Name | Description |
---|---|---|
bool | transparent | Whether the window is transparent or not. |
Show()
Shows the window if it is hidden.
Declaration
public void Show()
UngrabKey(int)
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.
Declaration
public bool UngrabKey(int DaliKey)
Parameters
Type | Name | Description |
---|---|---|
int | DaliKey | The key code to ungrab. |
Returns
Type | Description |
---|---|
bool | True if the ungrab succeeds. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | This exception can be thrown due to permission denied. |
UngrabKeyTopmost(int)
Ungrabs the key specified by a key for the 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.
Declaration
public bool UngrabKeyTopmost(int DaliKey)
Parameters
Type | Name | Description |
---|---|---|
int | DaliKey | The key code to ungrab. |
Returns
Type | Description |
---|---|
bool | True if the ungrab succeeds. |
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | This exception can be thrown due to permission denied. |
Unparent()
Unsets parent window of the window. After unsetting, the window is disconnected his parent window.
Declaration
public void Unparent()
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
Events
View SourceFocusChanged
This event is triggered when the focus changes on the window.
Declaration
public event EventHandler<Window.FocusChangedEventArgs> FocusChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><Window.FocusChangedEventArgs> |
KeyEvent
Emits the event when the key event is received.
Declaration
public event EventHandler<Window.KeyEventArgs> KeyEvent
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><Window.KeyEventArgs> |
Resized
Emits the event when window is resized by user or the display server.
Declaration
public event EventHandler<Window.ResizedEventArgs> Resized
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><Window.ResizedEventArgs> |
TouchEvent
Emits the event when the screen is touched and when the touch ends.
If there are multiple touch points then it is emitted when the first touch occurs and
when the last finger is lifted too.
Even though incoming events are interrupted, the event occurs.
Declaration
public event EventHandler<Window.TouchEventArgs> TouchEvent
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><Window.TouchEventArgs> |
WheelEvent
Emits the event when the wheel event is received.
Declaration
public event EventHandler<Window.WheelEventArgs> WheelEvent
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><Window.WheelEventArgs> |
Explicit Interface Implementations
View SourceIWindowProvider.Height
Declaration
float IWindowProvider.Height { get; }
Returns
Type | Description |
---|---|
float |
IWindowProvider.Rotation
Declaration
int IWindowProvider.Rotation { get; }
Returns
Type | Description |
---|---|
int |
IWindowProvider.Width
Declaration
float IWindowProvider.Width { get; }
Returns
Type | Description |
---|---|
float |
IWindowProvider.WindowHandle
Declaration
IntPtr IWindowProvider.WindowHandle { get; }
Returns
Type | Description |
---|---|
System.IntPtr |
IWindowProvider.X
Declaration
float IWindowProvider.X { get; }
Returns
Type | Description |
---|---|
float |
IWindowProvider.Y
Declaration
float IWindowProvider.Y { get; }
Returns
Type | Description |
---|---|
float |