stateMask = ENABLE_VIEWSTATE | VISIBLE | AUTOID | BINDING_CONTAINER | AUTO_EVENT_WIREUP;
if (this is INamingContainer)
stateMask |= IS_NAMING_CONTAINER;
+#if NET_2_0
+ stateMask |= ENABLE_THEMING;
+#endif
}
#if NET_2_0
public Control BindingContainer {
get {
Control container = NamingContainer;
- if ((container.stateMask & BINDING_CONTAINER) == 0)
+ if (container != null && (container.stateMask & BINDING_CONTAINER) == 0)
container = container.BindingContainer;
return container;
}
}
#if NET_2_0
+ [MonoTODO ("revisit once we have a real design strategy")]
protected internal bool DesignMode
{
- get {
- throw new NotImplementedException ();
- }
+ get { return false; }
}
#endif
protected internal bool IsViewStateEnabled
{
get {
- throw new NotImplementedException ();
+ if (Page == null)
+ return false;
+
+ for (Control control = this; control != null; control = control.Parent)
+ if (!control.EnableViewState)
+ return false;
+
+ return true;
}
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
public virtual void ApplyStyleSheetSkin (Page page)
{
+ if (!EnableTheming) /* this enough? */
+ return;
+
+ /* apply the style sheet skin here */
+ if (page.StyleSheetPageTheme != null) {
+ ControlSkin cs = page.StyleSheetPageTheme.GetControlSkin (GetType(), SkinID);
+ if (cs != null)
+ cs.ApplySkin (this);
+ }
}
#endif
trace.Write ("control", String.Format ("InitRecursive {0} {1}", _userId, type_name));
}
#endif
-
if (HasControls ()) {
if ((stateMask & IS_NAMING_CONTAINER) != 0)
namingContainer = this;
stateMask |= INITING;
#if NET_2_0
+ ApplyTheme ();
+
if (Adapter != null)
Adapter.OnInit (EventArgs.Empty);
else
#endif
stateMask |= VIEWSTATE_LOADED;
}
+
+#if NET_2_0
+ internal ControlSkin controlSkin;
+
+ internal void ApplyTheme ()
+ {
+#if MONO_TRACE
+ TraceContext trace = (Context != null && Context.Trace.IsEnabled) ? Context.Trace : null;
+ string type_name = null;
+ if (trace != null) {
+ type_name = GetType ().Name;
+ trace.Write ("control", String.Format ("ApplyThemeRecursive {0} {1}", _userId, type_name));
+ }
+#endif
+ if (Page.PageTheme != null) {
+ ControlSkin controlSkin = Page.PageTheme.GetControlSkin (GetType (), SkinID);
+ if (controlSkin != null)
+ controlSkin.ApplySkin (this);
+ }
+
+#if MONO_TRACE
+ if (trace != null)
+ trace.Write ("control", String.Format ("End ApplyThemeRecursive {0} {1}", _userId, type_name));
+#endif
+ }
+#endif
internal bool AutoID
{