PageTabContainers.h
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:6k
源码类别:

界面编程

开发平台:

Visual C++

  1. #if !defined(AFX_PAGETABCONTAINERS_H__815AD1B0_19DE_497D_9095_E4C754FCE4CD__INCLUDED_)
  2. #define AFX_PAGETABCONTAINERS_H__815AD1B0_19DE_497D_9095_E4C754FCE4CD__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // PageTabContainers.h : header file
  7. //
  8. #if (!defined __EXT_MFC_NO_TAB_PAGECONTAINER_CTRL && !defined __EXT_MFC_NO_TAB_PAGECONTAINER_FLAT_CTRL )
  9. #include "PageBase.h"
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CPageTabContainers dialog
  12. class CPageTabContainers : public CPageBase
  13. {
  14. // Construction
  15. public:
  16. CPageTabContainers(CWnd* pParent = NULL);   // standard constructor
  17. class CMyTabPageContainerWndFlat : public CExtTabPageContainerFlatWnd
  18. {
  19. // virtual void OnTabWndClickedItemCloseButton( LONG nItemIndex )
  20. // {
  21. // CString strMessage;
  22. // strMessage.Format( _T("Clicked X-button on %d tab item"), nItemIndex );
  23. // ::AfxMessageBox( LPCTSTR(strMessage) );
  24. // }
  25. class CMyTabWndFlat : public CExtTabFlatWnd
  26. {
  27. int m_nShift;
  28. int m_nSize;
  29. public:
  30. CMyTabWndFlat() : m_nShift( -1 ), m_nSize( -1 ) { }
  31. int GetShift()
  32. {
  33. CRect rc;
  34. GetWindowRect(rc);
  35. return _CalcRgnShift( OrientationIsHorizontal(), rc );
  36. }
  37. int GetSize() { return OnFlatTabWndGetSize( OrientationIsHorizontal() ); }
  38. void SetShift( int nShift ) { m_nShift = nShift; }
  39. void SetSize( int nSize ) { m_nSize = nSize; }
  40. protected:
  41. virtual int _CalcRgnShift( bool bHorz, const CRect & rc )
  42. {
  43. int nShift = 0;
  44. if( m_nShift >= 0 )
  45. nShift = m_nShift;
  46. else
  47. nShift = ::MulDiv( bHorz ? rc.Height() : rc.Width(), 1, 4 );
  48. return nShift;
  49. }
  50. virtual int OnFlatTabWndGetSize( bool bHorz )
  51. {
  52. int nSize = 0;
  53. if(bHorz)
  54. if( m_nSize > 0 )
  55. nSize = m_nSize;
  56. else
  57. nSize = 16;//::GetSystemMetrics( SM_CXHSCROLL );
  58. else
  59. if( m_nSize > 0 )
  60. nSize = m_nSize;
  61. else
  62. nSize = 16;//::GetSystemMetrics( SM_CYHSCROLL );
  63. return nSize;
  64. }
  65. }; // class CMyTabWndFlat
  66. virtual CExtTabWnd * OnTabWndGetTabImpl()
  67. {
  68. return new CExtTWPC < CMyTabWndFlat >;
  69. }
  70. virtual bool OnTabWndClickedButton(
  71. LONG nHitTest,
  72. bool bButtonPressed,
  73. INT nMouseButton, // MK_... values
  74. UINT nMouseEventFlags)
  75. {
  76. ASSERT_VALID( this );
  77. nMouseButton;
  78. nMouseEventFlags;
  79. if( nHitTest==__ETWH_BUTTON_CLOSE && !bButtonPressed ){
  80. TRACE1(""Close" button clicked on page %dn", PageSelectionGet());
  81. }
  82. if( nHitTest==__ETWH_BUTTON_HELP && !bButtonPressed ){
  83. TRACE1(""Help" button clicked on page %dn", PageSelectionGet());
  84. }
  85. return true;
  86. }
  87. public:
  88. void SetShift( int nShift ){
  89. ((CMyTabWndFlat*)m_pWndTab)->SetShift( nShift );
  90. ((CMyTabWndFlat*)m_pWndTab)->UpdateTabWnd();
  91. }
  92. void SetSize( int nSize ){
  93. ((CMyTabWndFlat*)m_pWndTab)->SetSize( nSize );
  94. ((CMyTabWndFlat*)m_pWndTab)->UpdateTabWnd();
  95. _RepositionBarsImpl();
  96. }
  97. int GetShift(){
  98. return ((CMyTabWndFlat*)m_pWndTab)->GetShift();
  99. }
  100. int GetSize(){
  101. return ((CMyTabWndFlat*)m_pWndTab)->GetSize();
  102. }
  103. }; // class CMyTabPageContainerWndFlat
  104. class CMyTabPageContainerWnd : public CExtTabPageContainerWnd
  105. {
  106. }; // class CMyTabPageContainerWnd
  107. CMyTabPageContainerWndFlat m_wndTabPageContainerFlat;
  108. CMyTabPageContainerWnd m_wndTabPageContainer;
  109. //CExtWRB<CMyTabPageContainerWnd> m_wndTabPageContainer;
  110. // Dialog Data
  111. //{{AFX_DATA(CPageTabContainers)
  112. enum { IDD = IDD_PAGE_TAB_CONTAINERS };
  113. CExtEdit m_wndSize;
  114. CExtEdit m_wndShift;
  115. CExtCheckBox m_CheckShowHome;
  116. CExtCheckBox m_CheckShowEnd;
  117. CExtCheckBox m_chkItemDragging;
  118. CExtCheckBox m_chkShowTabList;
  119. CExtCheckBox m_chkEnableTabList;
  120. CExtLabel m_StaticSize;
  121. CExtLabel m_StaticShift;
  122. CExtLabel m_StaticOrientation;
  123. CExtSpinWnd m_SpinSize;
  124. CExtSpinWnd m_SpinShift;
  125. CExtComboBox m_Orientation;
  126. CExtCheckBox m_chkShowHelp;
  127. CExtCheckBox m_chkShowClose;
  128. CExtCheckBox m_chkShowBorders;
  129. CExtCheckBox m_chkInvertVertFont;
  130. CExtCheckBox m_chkInclineBefore;
  131. CExtCheckBox m_chkInclineAfter;
  132. CExtCheckBox m_chkFullWidths;
  133. CExtCheckBox m_chkFocusOnHover;
  134. CExtCheckBox m_chkEqualWidths;
  135. CExtCheckBox m_chkEnableHelp;
  136. CExtCheckBox m_chkEnableClose;
  137. CExtCheckBox m_chkCenterText;
  138. CExtCheckBox m_chkBoldSelection;
  139. CExtCheckBox m_chkAutoHideScroll;
  140. int m_nShift;
  141. int m_nSize;
  142. //}}AFX_DATA
  143. // Overrides
  144. // ClassWizard generated virtual function overrides
  145. //{{AFX_VIRTUAL(CPageTabContainers)
  146. public:
  147. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
  148. protected:
  149. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  150. //}}AFX_VIRTUAL
  151. // Implementation
  152. protected:
  153. BOOL InitTreeCtrl(CTreeCtrl *pTreeCtrl, CExtTabPageContainerWnd* pTabsContainer);
  154. BOOL InitEditCtrl(CEdit *pEditCtrl, CExtTabPageContainerWnd* pTabsContainer);
  155. BOOL InitListBoxCtrl(CListBox *pListBox, CExtTabPageContainerWnd* pTabsContainer);
  156. bool m_bInitComplete:1;
  157. CExtColorCtrl m_wndColorCtrl0;
  158. CExtNCSB < CListBox > m_wndListBox0;
  159. CExtNCSB < CExtEdit > m_wndEditCtrl0;
  160. CExtNCSB < CExtWFF< CTreeCtrl > > m_wndTreeCtrl0;
  161. CExtResizableDialog m_wndTabPageDialog0;
  162. CExtColorCtrl m_wndColorCtrl1;
  163. CExtNCSB < CListBox >  m_wndListBox1;
  164. CExtNCSB < CExtEdit > m_wndEditCtrl1;
  165. CExtNCSB < CExtWFF< CTreeCtrl > > m_wndTreeCtrl1;
  166. CExtResizableDialog m_wndTabPageDialog1;
  167. // Generated message map functions
  168. //{{AFX_MSG(CPageTabContainers)
  169. virtual BOOL OnInitDialog();
  170. afx_msg void OnSelendokComboOrientation();
  171. //}}AFX_MSG
  172. DECLARE_MESSAGE_MAP()
  173. };
  174. #endif // #if (!defined __EXT_MFC_NO_TAB_PAGECONTAINER_CTRL && !defined __EXT_MFC_NO_TAB_PAGECONTAINER_FLAT_CTRL )
  175. //{{AFX_INSERT_LOCATION}}
  176. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  177. #endif // !defined(AFX_PAGETABCONTAINERS_H__815AD1B0_19DE_497D_9095_E4C754FCE4CD__INCLUDED_)