TIFFFrame.cpp
上传用户:lbr_007
上传日期:2019-05-31
资源大小:282k
文件大小:4k
源码类别:

传真(Fax)编程

开发平台:

Visual C++

  1. // TIFFFrame.cpp : implementation of the TIFFFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "TIFFSample.h"
  5. #include "TIFFFrame.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. CStatusBar * g_statusBar = 0;
  12. /////////////////////////////////////////////////////////////////////////////
  13. // TIFFFrame
  14. IMPLEMENT_DYNCREATE(TIFFFrame, CFrameWnd)
  15. BEGIN_MESSAGE_MAP(TIFFFrame, CFrameWnd)
  16. //{{AFX_MSG_MAP(TIFFFrame)
  17. ON_WM_CREATE()
  18. ON_WM_SIZE()
  19. //}}AFX_MSG_MAP
  20. END_MESSAGE_MAP()
  21. static UINT indicators[] =
  22. {
  23. ID_SEPARATOR,
  24. ID_SEPARATOR,
  25. ID_SEPARATOR,
  26. ID_SEPARATOR,
  27. };
  28. /////////////////////////////////////////////////////////////////////////////
  29. // TIFFFrame construction/destruction
  30. TIFFFrame::TIFFFrame()
  31. {
  32. // TODO: add member initialization code here
  33. }
  34. TIFFFrame::~TIFFFrame()
  35. {
  36. }
  37. int TIFFFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  38. {
  39. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  40. return -1;
  41. if (!m_wndToolBar.CreateEx(this) ||
  42. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  43. {
  44. TRACE0("Failed to create toolbarn");
  45. return -1;      // fail to create
  46. }
  47. if (!m_wndDlgBar.Create(this, IDD_DROPSIZE_DLG, 
  48. CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
  49. {
  50. TRACE0("Failed to create dialogbarn");
  51. return -1; // fail to create
  52. }
  53. if (!m_wndReBar.Create(this) ||
  54. !m_wndReBar.AddBar(&m_wndDlgBar)||
  55. !m_wndReBar.AddBar(&m_wndToolBar))
  56. {
  57. TRACE0("Failed to create rebarn");
  58. return -1;      // fail to create
  59. }
  60. if (!m_wndStatusBar.Create(this) ||
  61. !m_wndStatusBar.SetIndicators(indicators,
  62.   sizeof(indicators)/sizeof(UINT)))
  63. {
  64. TRACE0("Failed to create status barn");
  65. return -1;      // fail to create
  66. }
  67. g_statusBar = &m_wndStatusBar;
  68. if (!m_listBar.Create(this, IDD_CLICKLIST_DLG, CBRS_LEFT, ID_LEFTBAR_LIST))
  69. {
  70. TRACE0("Failed to create rebarn");
  71. return -1;
  72. }
  73. m_listBar.EnableDocking(CBRS_ALIGN_ANY);
  74. // TODO: Remove this if you don't want tool tips
  75. m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  76. CBRS_TOOLTIPS | CBRS_FLYBY);
  77. UINT nID;
  78. UINT nStyle;
  79. int cxWidth;
  80. m_wndStatusBar.GetPaneInfo(1,nID,nStyle,cxWidth);
  81. nStyle = SBPS_NORMAL;
  82. m_wndStatusBar.SetPaneInfo(1,nID,nStyle,60);
  83. m_wndStatusBar.GetPaneInfo(2,nID,nStyle,cxWidth);
  84. nStyle = SBPS_NORMAL;
  85. m_wndStatusBar.SetPaneInfo(2,nID,nStyle,160);
  86. m_wndStatusBar.GetPaneInfo(3,nID,nStyle,cxWidth);
  87. nStyle = SBPS_NORMAL;
  88. m_wndStatusBar.SetPaneInfo(3,nID,nStyle,160);
  89. EnableDocking(CBRS_ALIGN_ANY);
  90. //DockControlBar(&m_listBar);
  91. m_wndDlgBar.Setup();
  92. return 0;
  93. }
  94. BOOL TIFFFrame::PreCreateWindow(CREATESTRUCT& cs)
  95. {
  96. if( !CFrameWnd::PreCreateWindow(cs) )
  97. return FALSE;
  98. // TODO: Modify the Window class or styles here by modifying
  99. //  the CREATESTRUCT cs
  100. return TRUE;
  101. }
  102. /////////////////////////////////////////////////////////////////////////////
  103. // TIFFFrame diagnostics
  104. #ifdef _DEBUG
  105. void TIFFFrame::AssertValid() const
  106. {
  107. CFrameWnd::AssertValid();
  108. }
  109. void TIFFFrame::Dump(CDumpContext& dc) const
  110. {
  111. CFrameWnd::Dump(dc);
  112. }
  113. #endif //_DEBUG
  114. /////////////////////////////////////////////////////////////////////////////
  115. // TIFFFrame message handlers
  116. void TIFFFrame::OnSize(UINT nType, int cx, int cy) 
  117. {
  118. CFrameWnd::OnSize(nType, cx, cy);
  119. }
  120. void TIFFFrame::HideList(void)
  121. {
  122. m_listBar.ShowWindow(SW_HIDE);
  123. PostMessage(WM_SIZE, 0, 0);
  124. }
  125. void TIFFFrame::ShowList(void)
  126. {
  127. m_listBar.ShowWindow(SW_SHOW);
  128. PostMessage(WM_SIZE, 0, 0);
  129. }