3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * Namespace : System.Web.UI.MobileControls.Adapters
25 * Class : HtmlControlAdapter
26 * Author : Gaurav Vaish
28 * Copyright : 2003 with Gaurav Vaish, and with
33 using System
.Web
.Mobile
;
35 namespace System
.Web
.UI
.MobileControls
.Adapters
37 public class HtmlControlAdapter
: ControlAdapter
39 protected static readonly int NotSecondaryUI
= -1;
41 [MonoTODO("Whould_like_to_keep_it_FFFFFFFF")]
42 internal const int NotSecondaryUIInitial
= 0x7FFFFFFF;
44 private static string[] multimediaAttrs
= {
53 public HtmlControlAdapter()
57 protected HtmlFormAdapter FormAdapter
61 return (HtmlFormAdapter
)Control
.Form
.Adapter
;
65 protected HtmlPageAdapter PageAdapter
69 return (HtmlPageAdapter
)Page
.Adapter
;
74 protected int SecondaryUIMode
78 throw new NotImplementedException();
82 throw new NotImplementedException();
86 public virtual bool RequiresFormTag
95 private void AddAttributePrivate(HtmlMobileTextWriter writer
,
98 //string val = Control.GetAttribute(attribute);
99 string val
= String
.Empty
;
100 if(val
!= null && val
.Length
> 0)
102 writer
.WriteAttribute(attribute
, val
);
106 protected virtual void AddAccesskey(HtmlMobileTextWriter writer
)
108 if(Device
.SupportsAccesskeyAttribute
)
110 AddAttributePrivate(writer
, "accesskey");
114 protected virtual void AddAttributes(HtmlMobileTextWriter writer
)
118 protected virtual void AddJPhoneMultiMediaAttributes(
119 HtmlMobileTextWriter writer
)
121 if(Device
.SupportsJPhoneMultiMediaAttributes
)
123 foreach(string cAttrib
in multimediaAttrs
)
125 AddAttributePrivate(writer
, cAttrib
);
130 protected void ExitSecondaryUIMode()
132 this.SecondaryUIMode
= NotSecondaryUI
;
135 public override void LoadAdapterState(object state
)
137 if(state
!= null && state
is int)
139 this.SecondaryUIMode
= (int)state
;
143 public virtual void Render(HtmlMobileTextWriter writer
)
145 base.RenderChildren(writer
);
148 public override void Render(HtmlTextWriter writer
)
150 if(writer
is HtmlMobileTextWriter
)
152 Render((HtmlMobileTextWriter
)writer
);
156 protected virtual void RenderAsHiddenInputField(HtmlMobileTextWriter writer
)
161 protected void RenderBeginLink(HtmlMobileTextWriter writer
,
165 if(PageAdapter
.PersistCookielessData
)
167 if(target
.StartsWith("http:") || target
.StartsWith("https:"))
169 throw new NotImplementedException();
175 protected void RenderEndLink(HtmlMobileTextWriter writer
)
177 throw new NotImplementedException();
181 protected void RenderPostBackEventAsAnchor(HtmlMobileTextWriter writer
,
182 string argument
, string linkText
)
184 throw new NotImplementedException();
187 protected void RenderPostBackEventAsAttribute(HtmlMobileTextWriter writer
,
188 string name
, string value)
190 writer
.Write(" " + name
+ "=\"");
191 RenderPostBackEventReference(writer
, value);
195 protected void RenderPostBackEventReference(HtmlMobileTextWriter writer
,
198 PageAdapter
.RenderPostBackEvent(writer
, Control
.UniqueID
, argument
);
201 public override object SaveAdapterState()
203 int uiMode
= SecondaryUIMode
;
204 object retVal
= null;
205 if(uiMode
!= NotSecondaryUI
)