TemplateControl.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. //
  2. // System.Web.UI.TemplateControl.cs
  3. //
  4. // Duncan Mak ([email protected])
  5. //
  6. // (C) Ximian, Inc.
  7. //
  8. using System;
  9. namespace System.Web.UI {
  10. public abstract class TemplateControl : Control, INamingContainer
  11. {
  12. private object abortTransaction = new object ();
  13. private object commitTransaction = new object ();
  14. private object error = new object ();
  15. #region Constructor
  16. protected TemplateControl ()
  17. {
  18. Construct ();
  19. }
  20. #endregion
  21. #region Properties
  22. protected virtual int AutoHandlers
  23. {
  24. get { return 0; }
  25. set { }
  26. }
  27. protected virtual bool SupportAutoEvents
  28. {
  29. get { return true; }
  30. }
  31. #endregion
  32. #region Methods
  33. protected virtual void Construct ()
  34. {
  35. }
  36. [MonoTODO]
  37. protected virtual LiteralControl CreateResourceBasedLiteralControl (int offset,
  38. int size,
  39. bool fAsciiOnly)
  40. {
  41. return null;
  42. }
  43. protected virtual void FrameworkInitialize ()
  44. {
  45. }
  46. [MonoTODO]
  47. public Control LoadControl (string virtualPath)
  48. {
  49. return null;
  50. }
  51. [MonoTODO]
  52. public ITemplate LoadTemplate (string virtualPath)
  53. {
  54. return null;
  55. }
  56. protected virtual void OnAbortTransaction (EventArgs e)
  57. {
  58. EventHandler eh = (EventHandler) Events [error];
  59. if (eh != null)
  60. eh.Invoke (this, e);
  61. }
  62. protected virtual void OnCommitTransaction (EventArgs e)
  63. {
  64. EventHandler eh = (EventHandler) Events [commitTransaction];
  65. if (eh != null)
  66. eh.Invoke (this, e);
  67. }
  68. protected virtual void OnError (EventArgs e)
  69. {
  70. EventHandler eh = (EventHandler) Events [abortTransaction];
  71. if (eh != null)
  72. eh.Invoke (this, e);
  73. }
  74. [MonoTODO]
  75. public Control ParseControl (string content)
  76. {
  77. return null;
  78. }
  79. [MonoTODO]
  80. public static object ReadStringResource (Type t)
  81. {
  82. return null;
  83. }
  84. [MonoTODO]
  85. protected void SetStringResourcePointer (object stringResourcePointer,
  86. int maxResourceOffset)
  87. {
  88. }
  89. [MonoTODO]
  90. protected void WriteUTF8ResourceString (HtmlTextWriter output, int offset,
  91. int size, bool fAsciiOnly)
  92. {
  93. }
  94. #endregion
  95. #region Events
  96. public event EventHandler AbortTransaction
  97. {
  98. add {
  99. Events.AddHandler (abortTransaction, value);
  100. }
  101. remove {
  102. Events.RemoveHandler (abortTransaction, value);
  103. }
  104. }
  105. public event EventHandler CommitTransaction
  106. {
  107. add {
  108. Events.AddHandler (commitTransaction, value);
  109. }
  110. remove {
  111. Events.RemoveHandler (commitTransaction, value);
  112. }
  113. }
  114. public event EventHandler Error
  115. {
  116. add {
  117. Events.AddHandler (error, value);
  118. }
  119. remove {
  120. Events.RemoveHandler (error, value);
  121. }
  122. }
  123. #endregion
  124. }
  125. }