Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
1.6 KiB

  1. // Copyright (C) 2001 Microsoft Corporation
  2. //
  3. // Rich Edit streaming helper
  4. //
  5. // 28 Sep 2001 sburns
  6. #ifndef RICHEDITSTREAMER_HPP_INCLUDED
  7. #define RICHEDITSTREAMER_HPP_INCLUDED
  8. // Facilities streaming text into/out of a riched edit control. This is a
  9. // abstract base class. Derived classes need to provide an implementation of
  10. // the StreamCallback method. See class RichEditStringStreamer for an
  11. // example.
  12. class RichEditStreamer
  13. {
  14. public:
  15. // Returns the error state last returned by StreamCallback.
  16. virtual
  17. HRESULT
  18. ErrorResult();
  19. // Streams text into the rich edit control.
  20. int
  21. StreamIn(DWORD formatOptions = SF_RTF);
  22. // int
  23. // StreamOut(DWORD formatOptions = SF_RTF);
  24. protected:
  25. RichEditStreamer(HWND richEdit_);
  26. virtual
  27. ~RichEditStreamer();
  28. virtual
  29. HRESULT
  30. StreamCallback(
  31. PBYTE buffer,
  32. LONG bytesToTransfer,
  33. LONG* bytesTransferred) = 0;
  34. HWND richEdit;
  35. EDITSTREAM editStream;
  36. LONG bytesCopiedSoFar;
  37. enum StreamDirection
  38. {
  39. TO_CONTROL, // stream in
  40. FROM_CONTROL // stream out
  41. };
  42. StreamDirection direction;
  43. private:
  44. HRESULT
  45. StreamCallbackHelper(
  46. PBYTE buffer,
  47. LONG bytesToTransfer,
  48. LONG* bytesTransferred);
  49. static
  50. DWORD CALLBACK
  51. StaticStreamCallback(
  52. DWORD_PTR cookie,
  53. PBYTE buffer,
  54. LONG bytesToTransfer,
  55. LONG* bytesTransferred);
  56. };
  57. #endif // RICHEDITSTREAMER_HPP_INCLUDED