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

对话框与窗口

开发平台:

Visual C++

  1. /****************************************************************************
  2.  * *  
  3.  * GuiToolKit   *
  4.  *  (MFC extension) *  
  5.  * Created by Francisco Campos G. www.beyondata.com fcampos@beyondata.com *
  6.  *--------------------------------------------------------------------------*    
  7.  * *
  8.  * This program is free software;so you are free to use it any of your *
  9.  * applications (Freeware, Shareware, Commercial),but leave this header *
  10.  * intact. *
  11.  * *
  12.  * These files are provided "as is" without warranty of any kind. *
  13.  * *
  14.  *        GuiToolKit is forever FREE CODE !!!!! *
  15.  * *
  16.  *--------------------------------------------------------------------------*
  17.  * Created by: Francisco Campos G. *
  18.  * Bug Fixes and improvements : (Add your name) *
  19.  * -Francisco Campos *
  20.  * *
  21.  ****************************************************************************/
  22. #include "stdafx.h"
  23. #include "GuiDocSpecial.h"
  24. #ifdef _DEBUG
  25. #undef THIS_FILE
  26. static char THIS_FILE[]=__FILE__;
  27. #define new DEBUG_NEW
  28. #endif
  29. //////////////////////////////////////////////////////////////////////
  30. // Construction/Destruction
  31. //////////////////////////////////////////////////////////////////////
  32. #define _countof(array) (sizeof(array)/sizeof(array[0]))
  33. #define _AfxSetDlgCtrlID(hWnd, nID)     SetWindowLong(hWnd, GWL_ID, nID)
  34. #define _AfxGetDlgCtrlID(hWnd)          ((UINT)(WORD)::GetDlgCtrlID(hWnd))
  35. BEGIN_MESSAGE_MAP(CGuiDocSpecial,CDockBar)
  36.  //{{AFX_MSG_MAP(CGuiDocSpecial)
  37.  ON_WM_SIZE()
  38.  ON_WM_CREATE()
  39.  //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. CGuiDocSpecial::CGuiDocSpecial()
  42. {
  43. }
  44. CGuiDocSpecial::~CGuiDocSpecial()
  45. {
  46. }
  47. CSize CGuiDocSpecial::CalcDynamicLayout(int nLength,DWORD nMode)
  48. {
  49. CSize sz=CControlBar::CalcDynamicLayout(nLength,nMode);
  50. // sz.cx+=1;
  51. // sz.cy+=1;
  52. return sz;
  53. }
  54. int CGuiDocSpecial::OnCreate(LPCREATESTRUCT lpCreateStruct)
  55. {
  56. if (CDockBar::OnCreate(lpCreateStruct) == -1)
  57. return -1;
  58. return 0;
  59. }
  60. void CGuiDocSpecial::OnNcPaint()
  61. {
  62. CRect rcWindow;
  63. CRect rcClient;
  64. int m_iBorder=2; 
  65. CWindowDC dc(this);
  66. GetWindowRect(&rcWindow);
  67. GetClientRect(&rcClient);
  68. CBrush cbr;
  69. cbr.CreateSysColorBrush(GuiDrawLayer::GetRGBColorTabs());
  70. rcClient.OffsetRect(-rcWindow.TopLeft());
  71.     rcWindow.OffsetRect(-rcWindow.TopLeft());
  72.     ScreenToClient(rcWindow);
  73. rcClient.OffsetRect(-rcWindow.left,-rcWindow.top);
  74. dc.ExcludeClipRect(rcClient);   
  75. rcWindow.OffsetRect(-rcWindow.left, -rcWindow.top);
  76. int ibotton=rcWindow.bottom;
  77. rcWindow.top=rcWindow.bottom-m_iBorder;
  78. dc.FillRect(rcWindow,&cbr); 
  79. rcWindow.top=0;
  80. rcWindow.bottom+=3;
  81. dc.FillRect(rcWindow,&cbr); 
  82. //un truco primitivo que evita el efecto estar a un nivel encima de la otra barra
  83. dc.FillSolidRect(0,rcWindow.top,rcWindow.right+1,1,::GetSysColor(COLOR_BTNSHADOW)); 
  84. dc.FillSolidRect(0,rcWindow.top+1,rcWindow.right+1,1,::GetSysColor(COLOR_BTNHIGHLIGHT)); 
  85. }
  86. void CGuiDocSpecial::OnSize(UINT nType,int cx,int cy)
  87. {
  88. CDockBar::OnSize(nType,cx,cy);
  89. Invalidate();
  90. }
  91. /*
  92. void CGuiDocSpecial::RecalTabs()
  93. {
  94. int inumTabs=GetDockedCount();
  95. if (inumTabs > 1)
  96. {
  97. for (int i=0; i< inumTabs; i++)
  98. {
  99. //GetNumWnd(int m_numtab)
  100. CString m_caption;
  101. CWnd* pParent=(CWnd*)m_arrBars[i];
  102. ASSERT(pParent);
  103. int j=0;
  104. BOOL bFound=FALSE;
  105. while(j< m_tabwnd.GetCount())
  106. {
  107. if (m_tabwnd.GetNumWnd(j) == pParent)
  108. {
  109. bFound=TRUE;
  110. break;
  111. }
  112. j++;
  113. }
  114. if (bFound == FALSE)
  115. {
  116. pParent->GetWindowText(m_caption);
  117. m_tabwnd.Addtab(pParent,m_caption,i);
  118. }
  119. }
  120. }
  121. }
  122. */