PopoutFrame.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:5k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // PopoutFrame.cpp : implementation file
  2. //
  3. // This file is a part of the XTREME TOOLKIT PRO MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #include "stdafx.h"
  21. #include "PopoutFrame.h"
  22. #include "MainFrm.h"
  23. #include "resource.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CPopoutFrame
  31. IMPLEMENT_DYNCREATE(CPopoutFrame, CFrameWnd)
  32. CPopoutFrame::CPopoutFrame()
  33. {
  34. }
  35. CPopoutFrame::~CPopoutFrame()
  36. {
  37. }
  38. BEGIN_MESSAGE_MAP(CPopoutFrame, CFrameWnd)
  39. //{{AFX_MSG_MAP(CPopoutFrame)
  40. ON_WM_CREATE()
  41. ON_COMMAND(ID_POPFRAME_EXIT, OnPopframeExit)
  42. ON_WM_CLOSE()
  43. //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45. static UINT indicators[] =
  46. {
  47. ID_SEPARATOR,           // status line indicator
  48. ID_INDICATOR_CAPS,
  49. ID_INDICATOR_NUM,
  50. ID_INDICATOR_SCRL,
  51. };
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CPopoutFrame message handlers
  54. int CPopoutFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  55. {
  56. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  57. return -1;
  58. if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
  59. CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
  60. {
  61. TRACE0("Failed to create view windown");
  62. return -1;
  63. }
  64. if (!m_wndStatusBar.Create(this) ||
  65. !m_wndStatusBar.SetIndicators(indicators,
  66. sizeof(indicators)/sizeof(UINT)))
  67. {
  68. TRACE0("Failed to create status barn");
  69. return -1;      // fail to create
  70. }
  71. if (!InitCommandBars())
  72. return -1;
  73. CXTPCommandBars* pCommandBars = GetCommandBars();
  74. CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_POPOUTFRAME);
  75. pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage);
  76. CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Popout"), xtpBarTop);
  77. if (!pCommandBar ||
  78. !pCommandBar->LoadToolBar(IDR_POPOUT_TOOLBAR))
  79. {
  80. TRACE0("Failed to create toolbarn");
  81. return -1;
  82. }
  83. CXTPControlComboBox* pComboFind = (CXTPControlComboBox*)pCommandBar->GetControls()->Add(xtpControlComboBox, 0);
  84. pComboFind->SetDropDownListStyle();
  85. pComboFind->AddString(_T("str1"));
  86. pComboFind->AddString(_T("str2"));
  87. pComboFind->AddString(_T("str1"));
  88. pComboFind->AddString(_T("str2"));
  89. pComboFind->AddString(_T("str1"));
  90. pComboFind->AddString(_T("str2"));
  91. pComboFind->AddString(_T("str1"));
  92. pComboFind->AddString(_T("str2"));
  93. pComboFind->AddString(_T("str1"));
  94. pComboFind->AddString(_T("str2"));
  95. pComboFind->AddString(_T("str1"));
  96. pComboFind->AddString(_T("str2"));
  97. pComboFind->AddString(_T("str1"));
  98. pComboFind->AddString(_T("str2"));
  99. pComboFind->AddString(_T("str1"));
  100. pComboFind->AddString(_T("str2"));
  101. pComboFind->SetWidth(150);
  102. pComboFind->SetCaption(_T("Find"));
  103. pComboFind->SetStyle(xtpComboLabel);
  104. m_paneManager.InstallDockingPanes(this);
  105. CXTPDockingPane* pwndPaneFrame = m_paneManager.CreatePane(
  106. 8, CRect(0, 0,200, 120), xtpPaneDockRight);
  107. pwndPaneFrame->SetTitle(_T("Empty Pane"));
  108. m_paneManager.SetTheme(xtpPaneThemeOffice);
  109. // Resize
  110. CRect r;
  111. GetWindowRect(&r);
  112. int cx = r.Width()/4;
  113. int cy = r.Height()/4;
  114. r.DeflateRect(cx, cy);
  115. MoveWindow(&r);
  116. return 0;
  117. }
  118. BOOL CPopoutFrame::PreCreateWindow(CREATESTRUCT& cs)
  119. {
  120. if( !CFrameWnd::PreCreateWindow(cs) )
  121. return FALSE;
  122. // TODO: Modify the Window class or styles here by modifying
  123. //  the CREATESTRUCT cs
  124. // Helps to reduce screen flicker.
  125. cs.lpszClass = AfxRegisterWndClass(0, NULL, NULL,
  126. AfxGetApp()->LoadIcon(IDR_MAINFRAME));
  127. cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
  128. cs.style &= ~WS_BORDER;
  129. cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
  130. return TRUE;
  131. }
  132. void CPopoutFrame::OnPopframeExit()
  133. {
  134. SendMessage(WM_CLOSE);
  135. }
  136. void CPopoutFrame::OnClose()
  137. {
  138. CFrameWnd::OnClose();
  139. CMainFrame* pFrameWnd = (CMainFrame*)AfxGetMainWnd();
  140. if (pFrameWnd != NULL)
  141. pFrameWnd->m_pNewFrameWnd = NULL;
  142. }