/3rd_party/wtl/AppWiz/Files/Templates/1033/ChildFrm.h

https://code.google.com/p/softart/ · C Header · 90 lines · 69 code · 12 blank · 9 comment · 5 complexity · 97ee5ebe40f7826b51d6bd7663550570 MD5 · raw file

  1. // [!output WTL_CHILD_FRAME_FILE].h : interface of the [!output WTL_CHILD_FRAME_CLASS] class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. #pragma once
  5. class [!output WTL_CHILD_FRAME_CLASS] : public [!output WTL_CHILD_FRAME_BASE_CLASS]<[!output WTL_CHILD_FRAME_CLASS]>
  6. {
  7. public:
  8. DECLARE_FRAME_WND_CLASS(NULL, IDR_MDICHILD)
  9. [!if WTL_USE_VIEW]
  10. [!output WTL_VIEW_CLASS] m_view;
  11. [!endif]
  12. [!if WTL_VIEWTYPE_LISTBOX || WTL_VIEWTYPE_EDIT || WTL_VIEWTYPE_RICHEDIT]
  13. CFont m_font;
  14. [!endif]
  15. [!if WTL_USE_CPP_FILES]
  16. virtual void OnFinalMessage(HWND /*hWnd*/);
  17. [!else]
  18. virtual void OnFinalMessage(HWND /*hWnd*/)
  19. {
  20. delete this;
  21. }
  22. [!endif]
  23. BEGIN_MSG_MAP([!output WTL_CHILD_FRAME_CLASS])
  24. [!if WTL_USE_VIEW]
  25. MESSAGE_HANDLER(WM_CREATE, OnCreate)
  26. [!endif]
  27. MESSAGE_HANDLER(WM_FORWARDMSG, OnForwardMsg)
  28. CHAIN_MSG_MAP([!output WTL_CHILD_FRAME_BASE_CLASS]<[!output WTL_CHILD_FRAME_CLASS]>)
  29. END_MSG_MAP()
  30. // Handler prototypes (uncomment arguments if needed):
  31. // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  32. // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  33. // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
  34. [!if WTL_USE_VIEW]
  35. [!if WTL_USE_CPP_FILES]
  36. LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  37. [!else]
  38. LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
  39. {
  40. [!if WTL_VIEWTYPE_FORM]
  41. m_hWndClient = m_view.Create(m_hWnd);
  42. [!else]
  43. [!if WTL_VIEWTYPE_HTML]
  44. //TODO: Replace with a URL of your choice
  45. m_hWndClient = m_view.Create(m_hWnd, rcDefault, _T("http://www.microsoft.com"), [!output WTL_VIEW_STYLES], [!output WTL_VIEW_EX_STYLES]);
  46. [!else]
  47. m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, [!output WTL_VIEW_STYLES], [!output WTL_VIEW_EX_STYLES]);
  48. [!if WTL_VIEWTYPE_LISTBOX || WTL_VIEWTYPE_EDIT || WTL_VIEWTYPE_RICHEDIT]
  49. m_font = AtlCreateControlFont();
  50. m_view.SetFont(m_font);
  51. [!endif]
  52. [!if WTL_VIEWTYPE_SCROLL]
  53. // replace with appropriate values for the app
  54. m_view.SetScrollSize(2000, 1000);
  55. [!endif]
  56. [!endif]
  57. [!endif]
  58. bHandled = FALSE;
  59. return 1;
  60. }
  61. [!endif]
  62. [!endif]
  63. [!if WTL_USE_CPP_FILES]
  64. LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
  65. [!else]
  66. LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
  67. {
  68. LPMSG pMsg = (LPMSG)lParam;
  69. [!if WTL_USE_VIEW]
  70. if([!output WTL_CHILD_FRAME_BASE_CLASS]<[!output WTL_CHILD_FRAME_CLASS]>::PreTranslateMessage(pMsg))
  71. return TRUE;
  72. return m_view.PreTranslateMessage(pMsg);
  73. [!else]
  74. return [!output WTL_CHILD_FRAME_BASE_CLASS]<[!output WTL_CHILD_FRAME_CLASS]>::PreTranslateMessage(pMsg);
  75. [!endif]
  76. }
  77. [!endif]
  78. };