summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Native/Page.cs
blob: 0ade2f2b429d822ad2cfa4a95ec629cf450ac6a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;
using ElmSharp;

namespace Xamarin.Forms.Platform.Tizen.Native
{
	/// <summary>
	/// A basic page which can hold a single view.
	/// </summary>
	public class Page : Background, IContainable<EvasObject>
	{
		/// <summary>
		/// The name of the part to be used when setting content.
		/// </summary>
		public const string ContentPartName = "overlay";

		/// <summary>
		/// Exposes the Children property, mapping it to the _canvas' Children property.
		/// </summary>
		public IList<EvasObject> Children => _canvas.Children;

		/// <summary>
		/// The canvas, used as a container for other objects.
		/// </summary>
		/// <remarks>
		/// The canvas holds all the Views that the ContentPage is composed of.
		/// </remarks>
		internal Canvas _canvas;

		/// <summary>
		/// Initializes a new instance of the ContentPage class.
		/// </summary>
		public Page(EvasObject parent) : base(parent)
		{
			_canvas = new Canvas(this);
			SetPartContent(ContentPartName, _canvas);
		}

		/// <summary>
		/// Allows custom handling of events emitted when the layout has been updated.
		/// </summary>
		public event EventHandler<LayoutEventArgs> LayoutUpdated
		{
			add
			{
				_canvas.LayoutUpdated += value;
			}
			remove
			{
				_canvas.LayoutUpdated -= value;
			}
		}

		/// <summary>
		/// Handles the disposing of a ContentPage
		/// </summary>
		/// <remarks>
		/// Takes the proper care of discarding the canvas, then calls the base method.
		/// </remarks>
		protected override void OnUnrealize()
		{
			_canvas.Unrealize();
			base.OnUnrealize();
		}
	}
}