StyleStack.cs 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Project : Mono
  3. * Namespace : System.Web.UI.MobileControls.Adapters
  4. * Class : StyleStack
  5. * Author : Gaurav Vaish
  6. *
  7. * Copyright : 2003 with Gaurav Vaish, and with
  8. * Ximian Inc
  9. */
  10. using System;
  11. using System.Collections;
  12. using System.Web.Mobile;
  13. namespace System.Web.UI.MobileControls.Adapters
  14. {
  15. class StyleStack
  16. {
  17. private HtmlMobileTextWriter writer;
  18. private Stack stack;
  19. protected StyleStack(HtmlMobileTextWriter writer)
  20. {
  21. this.writer = writer;
  22. stack = new Stack();
  23. }
  24. public int Count
  25. {
  26. get
  27. {
  28. return stack.Count;
  29. }
  30. }
  31. public WriterStyle Peek()
  32. {
  33. WriterStyle retVal = null;
  34. if(stack.Count > 0)
  35. retVal = (WriterStyle)stack.Peek();
  36. return retVal;
  37. }
  38. public WriterStyle Pop()
  39. {
  40. WriterStyle retVal = null;
  41. if(stack.Count > 0)
  42. retVal = (WriterStyle)stack.Pop();
  43. return retVal;
  44. }
  45. public void Push(WriterStyle style)
  46. {
  47. stack.Push(style);
  48. writer.ShouldEnsureStyle = true;
  49. }
  50. }
  51. }