tab_dlg_barView.cpp
上传用户:ledjyj
上传日期:2019-03-13
资源大小:36k
文件大小:3k
源码类别:

工具条

开发平台:

Visual C++

  1. // tab_dlg_barView.cpp : implementation of the Ctab_dlg_barView class
  2. //
  3. #include "stdafx.h"
  4. #include "tab_dlg_bar.h"
  5. #include "tab_dlg_barDoc.h"
  6. #include "tab_dlg_barView.h"
  7. #include ".tab_dlg_barview.h"
  8. #include "page1.h"
  9. #include "page2.h"
  10. #include "page3.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #endif
  14. // Ctab_dlg_barView
  15. IMPLEMENT_DYNCREATE(Ctab_dlg_barView, CEditView)
  16. BEGIN_MESSAGE_MAP(Ctab_dlg_barView, CEditView)
  17. // Standard printing commands
  18. ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
  19. ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
  20. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
  21. ON_WM_CREATE()
  22. END_MESSAGE_MAP()
  23. // Ctab_dlg_barView construction/destruction
  24. Ctab_dlg_barView::Ctab_dlg_barView()
  25. {
  26. // TODO: add construction code here
  27. }
  28. Ctab_dlg_barView::~Ctab_dlg_barView()
  29. {
  30. delete page1;
  31. delete page2;
  32. delete page3;
  33. }
  34. BOOL Ctab_dlg_barView::PreCreateWindow(CREATESTRUCT& cs)
  35. {
  36. // TODO: Modify the Window class or styles here by modifying
  37. //  the CREATESTRUCT cs
  38. return CEditView::PreCreateWindow(cs);
  39. }
  40. // Ctab_dlg_barView drawing
  41. void Ctab_dlg_barView::OnDraw(CDC* /*pDC*/)
  42. {
  43. Ctab_dlg_barDoc* pDoc = GetDocument();
  44. ASSERT_VALID(pDoc);
  45. if (!pDoc)
  46. return;
  47. // TODO: add draw code for native data here
  48. }
  49. // Ctab_dlg_barView printing
  50. BOOL Ctab_dlg_barView::OnPreparePrinting(CPrintInfo* pInfo)
  51. {
  52. // default preparation
  53. return DoPreparePrinting(pInfo);
  54. }
  55. void Ctab_dlg_barView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  56. {
  57. // TODO: add extra initialization before printing
  58. }
  59. void Ctab_dlg_barView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  60. {
  61. // TODO: add cleanup after printing
  62. }
  63. // Ctab_dlg_barView diagnostics
  64. #ifdef _DEBUG
  65. void Ctab_dlg_barView::AssertValid() const
  66. {
  67. CEditView::AssertValid();
  68. }
  69. void Ctab_dlg_barView::Dump(CDumpContext& dc) const
  70. {
  71. CEditView::Dump(dc);
  72. }
  73. Ctab_dlg_barDoc* Ctab_dlg_barView::GetDocument() const // non-debug version is inline
  74. {
  75. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Ctab_dlg_barDoc)));
  76. return (Ctab_dlg_barDoc*)m_pDocument;
  77. }
  78. #endif //_DEBUG
  79. // Ctab_dlg_barView message handlers
  80. int Ctab_dlg_barView::OnCreate(LPCREATESTRUCT lpCreateStruct)
  81. {
  82. if (CEditView::OnCreate(lpCreateStruct) == -1)
  83. return -1;
  84. page1=new CPage1;
  85. page2=new CPage2;
  86. page3=new CPage3;
  87. page1->m_pView=this;
  88. page2->m_pView=this;
  89. page3->m_pView=this;
  90. // NOTE: you MUST add pages before calling CPropSheetBar::Create, because Create needs to know size of dlgs it contains
  91. m_PropSheetBar.AddPage(page1);
  92. m_PropSheetBar.AddPage(page2);
  93. m_PropSheetBar.AddPage(page3);
  94. CFrameWnd *pFrameWnd=(CFrameWnd *)GetParent();
  95. if (!m_PropSheetBar.Create("test bar",pFrameWnd, AFX_IDW_CONTROLBAR_FIRST+40))
  96. {
  97. TRACE0("Failed to create PropSheetBarn");
  98. return -1;      // fail to create
  99. }
  100. m_PropSheetBar.EnableDocking(CBRS_ALIGN_ANY);
  101. pFrameWnd->EnableDocking(CBRS_ALIGN_ANY);
  102. pFrameWnd->DockControlBar(&m_PropSheetBar);
  103. return 0;
  104. }