Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Panel.cs « System.Web.UI.MobileControls « System.Web.Mobile « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 33d4581383aeb9ea85f6e7615e2c11efc6bdfb46 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
 * Project   : Mono
 * Namespace : System.Web.UI.MobileControls
 * Class     : Panel
 * Author    : Gaurav Vaish
 *
 * Copyright : 2003 with Gaurav Vaish, and with
 *             Ximian Inc
 */

using System.Collections;
using System.Web.UI;
using System.Web.Mobile;

namespace System.Web.UI.MobileControls
{
	public class Panel : MobileControl, ITemplateable
	{
		private Panel deviceSpecificContent;
		private bool  paginationStateChanged = false;

		public Panel()
		{
		}

		public override bool BreakAfter
		{
			get
			{
				return base.BreakAfter;
			}
			set
			{
				base.BreakAfter = value;
			}
		}

		protected override bool PaginateChildren
		{
			get
			{
				return Paginate;
			}
		}

		public virtual bool Paginate
		{
			get
			{
				object o = ViewState["Paginate"];
				if(o != null)
					return (bool)o;
				return false;
			}
			set
			{
				bool oldPaginate = Paginate;
				ViewState["Paginate"] = value;
				if(IsTrackingViewState)
				{
					PaginationStateChanged = true;
					if(oldPaginate && !value)
						MobileControl.SetControlPageRecursive(this, 1);
				}
			}
		}

		public Panel Content
		{
			get
			{
				return deviceSpecificContent;
			}
		}

		internal bool PaginationStateChanged
		{
			get
			{
				return paginationStateChanged;
			}
			set
			{
				paginationStateChanged = value;
			}
		}

		public override void AddLinkedForms(IList linkedForms)
		{
			try
			{
				foreach(Control current in Controls)
				{
					if(current is MobileControl)
						((MobileControl)current).AddLinkedForms(linkedForms);
				}
			} finally
			{
				if(linkedForms.GetEnumerator() is IDisposable)
					((IDisposable)linkedForms.GetEnumerator()).Dispose();
			}
		}

		public override void CreateDefaultTemplatedUI(bool doDataBind)
		{
			ITemplate contentTmpl = GetTemplate(Constants.ContentTemplateTag);
			if(contentTmpl != null)
			{
				deviceSpecificContent = new TemplateContainer();
				contentTmpl.InstantiateIn(this);
				Controls.AddAt(0, deviceSpecificContent);
			}
		}

		public override void PaginateRecursive(ControlPager pager)
		{
			if(EnablePagination)
			{
				if(Paginate && Content != null)
				{
					Content.Paginate = true;
					Content.PaginateRecursive(pager);
					FirstPage = Content.FirstPage;
					LastPage  = pager.PageCount;
					base.PaginateRecursive(pager);
				}
			}
		}

		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);
			if(IsTemplated)
			{
				ClearChildViewState();
				CreateTemplatedUI(false);
				ChildControlsCreated = true;
			}
		}
	}
}