CGuiFlatTabbedViewView.cpp
上传用户:wlkj888
上传日期:2022-08-01
资源大小:806k
文件大小:8k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // CGuiFlatTabbedViewView.cpp : implementation of the CCGuiFlatTabbedViewView class
  2. //
  3. #include "stdafx.h"
  4. #include "CGuiFlatTabbedView.h"
  5. #include "CGuiFlatTabbedViewDoc.h"
  6. #include "CGuiFlatTabbedViewView.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CCGuiFlatTabbedViewView
  14. IMPLEMENT_DYNCREATE(CCGuiFlatTabbedViewView, CGuiViewWorkTab)
  15. BEGIN_MESSAGE_MAP(CCGuiFlatTabbedViewView, CGuiViewWorkTab)
  16. //{{AFX_MSG_MAP(CCGuiFlatTabbedViewView)
  17. ON_WM_CREATE()
  18. ON_WM_SIZE()
  19. //}}AFX_MSG_MAP
  20. // Standard printing commands
  21. ON_COMMAND(ID_FILE_PRINT, CGuiViewWorkTab::OnFilePrint)
  22. ON_COMMAND(ID_FILE_PRINT_DIRECT, CGuiViewWorkTab::OnFilePrint)
  23. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CGuiViewWorkTab::OnFilePrintPreview)
  24. ON_WM_WINDOWPOSCHANGING()
  25. END_MESSAGE_MAP()
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CCGuiFlatTabbedViewView construction/destruction
  28. CCGuiFlatTabbedViewView::CCGuiFlatTabbedViewView()
  29. {
  30. // TODO: add construction code here
  31. }
  32. CCGuiFlatTabbedViewView::~CCGuiFlatTabbedViewView()
  33. {
  34. }
  35. BOOL CCGuiFlatTabbedViewView::PreCreateWindow(CREATESTRUCT& cs)
  36. {
  37. // TODO: Modify the Window class or styles here by modifying
  38. //  the CREATESTRUCT cs
  39. return CGuiViewWorkTab::PreCreateWindow(cs);
  40. }
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CCGuiFlatTabbedViewView drawing
  43. void CCGuiFlatTabbedViewView::OnDraw(CDC* pDC)
  44. {
  45. CCGuiFlatTabbedViewDoc* pDoc = GetDocument();
  46. ASSERT_VALID(pDoc);
  47. // TODO: add draw code for native data here
  48. }
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CCGuiFlatTabbedViewView printing
  51. BOOL CCGuiFlatTabbedViewView::OnPreparePrinting(CPrintInfo* pInfo)
  52. {
  53. // default preparation
  54. return DoPreparePrinting(pInfo);
  55. }
  56. void CCGuiFlatTabbedViewView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  57. {
  58. // TODO: add extra initialization before printing
  59. }
  60. void CCGuiFlatTabbedViewView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  61. {
  62. // TODO: add cleanup after printing
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CCGuiFlatTabbedViewView diagnostics
  66. #ifdef _DEBUG
  67. void CCGuiFlatTabbedViewView::AssertValid() const
  68. {
  69. CGuiViewWorkTab::AssertValid();
  70. }
  71. void CCGuiFlatTabbedViewView::Dump(CDumpContext& dc) const
  72. {
  73. CGuiViewWorkTab::Dump(dc);
  74. }
  75. CCGuiFlatTabbedViewDoc* CCGuiFlatTabbedViewView::GetDocument() // non-debug version is inline
  76. {
  77. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCGuiFlatTabbedViewDoc)));
  78. return (CCGuiFlatTabbedViewDoc*)m_pDocument;
  79. }
  80. #endif //_DEBUG
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CCGuiFlatTabbedViewView message handlers
  83. CListct::CListct()
  84. {
  85. }
  86. CListct::~CListct()
  87. {
  88. }
  89. BEGIN_MESSAGE_MAP(CListct, CListCtrl)
  90. //{{AFX_MSG_MAP(COutputList)
  91. ON_WM_WINDOWPOSCHANGING()
  92. ON_WM_CONTEXTMENU()
  93. //}}AFX_MSG_MAP
  94. END_MESSAGE_MAP()
  95. /////////////////////////////////////////////////////////////////////////////
  96. // COutputList message handlers
  97. void CListct::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) 
  98. {
  99. CListCtrl::OnWindowPosChanging(lpwndpos);
  100. // Hide horizontal scrollbar:
  101. ShowScrollBar (SB_HORZ, FALSE);
  102. ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
  103. }
  104. COutputList::COutputList()
  105. {
  106. }
  107. COutputList::~COutputList()
  108. {
  109. }
  110. BEGIN_MESSAGE_MAP(COutputList, CListBox)
  111. //{{AFX_MSG_MAP(COutputList)
  112. ON_WM_WINDOWPOSCHANGING()
  113. ON_WM_CONTEXTMENU()
  114. //}}AFX_MSG_MAP
  115. END_MESSAGE_MAP()
  116. /////////////////////////////////////////////////////////////////////////////
  117. // COutputList message handlers
  118. void COutputList::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) 
  119. {
  120. CListBox::OnWindowPosChanging(lpwndpos);
  121. // Hide horizontal scrollbar:
  122. // ShowScrollBar (SB_HORZ, FALSE);
  123. // ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
  124. }
  125. int CCGuiFlatTabbedViewView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  126. {
  127. if (CGuiViewWorkTab::OnCreate(lpCreateStruct) == -1)
  128. return -1;
  129. CFont m_Font;
  130. m_Font.CreateStockObject (DEFAULT_GUI_FONT);
  131. CRect rectClient (0, 0, lpCreateStruct->cx, lpCreateStruct->cy);
  132. const DWORD dwStyle =  LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;
  133. m_list.Create(
  134.    WS_CHILD|WS_VISIBLE|LVS_REPORT,
  135.    CRect(0,0,0,0), &m_guiWorktab, 2);
  136. m_wndEdit.Create (dwStyle, rectClient, &m_guiWorktab, 1);
  137. m_wndFind1.Create (dwStyle, rectClient, &m_guiWorktab, 3);
  138. m_wndFind2.Create (dwStyle, rectClient, &m_guiWorktab, 4);
  139. m_wndResult.Create (dwStyle, rectClient, &m_guiWorktab, 5);
  140. m_wndSqlDebug.Create (dwStyle, rectClient, &m_guiWorktab, 6);
  141. m_wndEdit.SetFont (&m_Font);
  142. m_wndFind1.SetFont (&m_Font);
  143. m_wndFind2.SetFont (&m_Font);
  144. m_wndResult.SetFont (&m_Font);
  145. m_wndSqlDebug.SetFont (&m_Font);
  146. /* m_wndEdit.SetOwner (this);
  147. m_wndFind1.SetOwner (this);
  148. m_wndFind2.SetOwner (this);
  149. m_wndResult.SetOwner (this);
  150. m_wndSqlDebug.SetOwner (this);
  151. */ //----------------------------------------------
  152. CString str;
  153. for (int i=0;i < 100;i++)
  154. {
  155. str.Format(_T("Item No:%d this is a laaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarge streamcccccc"), i);
  156. m_wndEdit.AddString( str);
  157. }
  158. //-----------------------------------------------
  159. CRect rect;
  160. m_list.GetClientRect(&rect);
  161. int nInterval = rect.Width()/5;
  162. // Create the columns
  163. // Put 10 items in the list
  164. LV_ITEM lvi;
  165. TCHAR szItem[256];
  166. TCHAR szCol[256];
  167. lvi.mask = LVIF_TEXT;
  168. for ( i=0; i  < 20; i++)
  169. {
  170. _stprintf(szCol, _T("Column %d"), i);
  171. m_list.InsertColumn(0, szCol, LVCFMT_LEFT,80);
  172. lvi.iItem = 0;
  173. lvi.iSubItem = 0;
  174. _stprintf(szItem, _T("Option %d"), i);
  175. lvi.pszText = szItem;
  176. m_list.InsertItem(&lvi);
  177. for (int j=1; j  < 20; j++)
  178. {
  179. lvi.iSubItem = j;
  180. strcpy(szItem,"My List");
  181. m_list.SetItem(&lvi);
  182. }
  183. }
  184. ListView_SetExtendedListViewStyleEx(m_list.GetSafeHwnd(), LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES , LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
  185. //------------------------------------------------
  186. m_guiWorktab.Addtab (&m_wndEdit, _T("Build"), -1);
  187. m_guiWorktab.Addtab (&m_list, _T("CLisCtrl"), -1);
  188. m_guiWorktab.Addtab (&m_wndFind1, _T("Find in Files 1"), -1);
  189. m_guiWorktab.Addtab (&m_wndFind2, _T("Find in Files 2"), -1);
  190. m_guiWorktab.Addtab (&m_wndResult, _T("Results"), -1);
  191. m_guiWorktab.Addtab (&m_wndSqlDebug, _T("Sql Debugging"), -1);
  192. m_guiWorktab.SetActualTitle(FALSE);
  193. // TODO: Add your specialized creation code here
  194. return 0;
  195. }
  196. void CCGuiFlatTabbedViewView::OnSize(UINT nType, int cx, int cy) 
  197. {
  198. CGuiViewWorkTab::OnSize(nType, cx, cy);
  199. CClientDC dc (this);
  200. CString strItem;
  201. m_wndEdit.GetText (90, strItem);
  202. int cxExtentMax = 0;
  203. cxExtentMax = dc.GetTextExtent (strItem).cx;
  204. m_wndEdit.SetHorizontalExtent (cxExtentMax);
  205. // TODO: Add your message handler code here
  206. }
  207. void CCGuiFlatTabbedViewView::OnWindowPosChanging(WINDOWPOS* lpwndpos)
  208. {
  209. CGuiViewWorkTab::OnWindowPosChanging(lpwndpos);
  210. // m_wndEdit.ShowScrollBar (SB_HORZ, FALSE);
  211. // m_wndEdit.ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
  212. m_list.ShowScrollBar (SB_HORZ, FALSE);
  213. m_list.ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
  214. m_wndFind1.ShowScrollBar (SB_HORZ, FALSE);
  215. m_wndFind1.ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
  216. m_wndFind2.ShowScrollBar (SB_HORZ, FALSE);
  217. m_wndFind2.ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
  218. m_wndResult.ShowScrollBar (SB_HORZ, FALSE);
  219. m_wndResult.ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
  220. m_wndSqlDebug.ShowScrollBar (SB_HORZ, FALSE);
  221. m_wndSqlDebug.ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
  222. // TODO: Add your message handler code here
  223. }