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

界面编程

开发平台:

Visual C++

  1. // PageTreeCtrl.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "profuis_controls.h"
  5. #include "PageTreeCtrl.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. #if ( ! defined __EXT_MFC_NO_TREE_VIEW_CTRL )
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CPageTreeCtrl dialog
  14. CPageTreeCtrl::CPageTreeCtrl(CWnd* pParent /*=NULL*/)
  15. : CPageBase(CPageTreeCtrl::IDD, pParent)
  16. , m_bInitComplete( false )
  17. {
  18. //{{AFX_DATA_INIT(CPageTreeCtrl)
  19. //}}AFX_DATA_INIT
  20. }
  21. void CPageTreeCtrl::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CPageBase::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(CPageTreeCtrl)
  25. DDX_Control(pDX, IDC_CHECK_EXPANDED_ONLY, m_wndCheckBoxExpandedOnly);
  26. DDX_Control(pDX, IDC_CHECK_FULL_ROW_SELECT, m_wndFullRowSelectCheckBox);
  27. DDX_Control(pDX, IDC_CHECK_HAS_BUTTONS, m_wndHasButtonsCheckBox);
  28. DDX_Control(pDX, IDC_CHECK_HAS_LINES, m_wndHasLinesCheckBox);
  29. DDX_Control(pDX, IDC_CHECK_LINES_AT_ROOT, m_wndLineSatRoot);
  30. DDX_Control(pDX, IDC_CHECK_SHOW_SEL_ALWAYS, m_wndShowSelAlwaysCheckBox);
  31. DDX_Control(pDX, IDC_CHECK_SINGLE_EXPAND, m_wndSingleExpandCheckBox);
  32. DDX_Control(pDX, IDC_CHECK_TRACK_SELECT, m_wndTrackSelectCheckBox);
  33. DDX_Control(pDX, IDC_CHECK_HOVER_DISABLE_ITEMS, m_wndHoverDisableItemsCheckBox);
  34. DDX_Control(pDX, IDC_CHECK_HOVER_TREE_BOX_EX, m_wndHoverTreeBoxExCheckBox);
  35. DDX_Control(pDX, IDC_CHECK_HOVER_CHECK_BOX_EX, m_wndHoverCheckBoxExCheckBox);
  36. DDX_Control(pDX, IDC_CHECK_HOVER_RADIO_BOX_EX, m_wndHoverRadioBoxExCheckBox);
  37. DDX_Control(pDX, IDC_CHECK_MULTIPLE_SELECTION, m_wndMultipleSelectionCheckBox);
  38. DDX_Control(pDX, IDC_CHECK_FOCUS_DISABLE_ITEMS, m_wndFocusDisableItemsCheckBox);
  39. DDX_Control(pDX, IDC_CHECK_SELECT_DISABLE_ITEMS, m_wndSelectDisableItemsCheckBox);
  40. DDX_Control(pDX, IDC_CHECK_SELECT_COLLAPSED_ITEMS, m_wndSelectCollapsedItemsCheckBox);
  41. DDX_Control(pDX, IDC_CHECK_SUBTRACT_SELECTION, m_wndSubtractSelectionCheckBox);
  42. DDX_Control(pDX, IDC_CHECK_SOLID_OUTLINE, m_wndOutlineSolidCheckBox);
  43. DDX_Control(pDX, IDC_CHECK_TREE_BOX_BITMAP, m_wndTreeBoxBitmapCheckBox);
  44. DDX_Control(pDX, IDC_CHECK_TREE_BOX_SQUARE, m_wndTreeBoxSquareCheckBox);
  45. DDX_Control(pDX, IDC_CHECK_TREE_BOX_ROUND, m_wndTreeBoxRoundCheckBox);
  46. DDX_Control(pDX, IDC_CHECK_INFO_TIP, m_wndInfoTipCheckBox);
  47. DDX_Control(pDX, IDC_CHECK_EDIT_LABELS, m_wndEditLabelsCheckBox);
  48. DDX_Control(pDX, IDC_CHECK_READ_ONLY_LABELS, m_wndReadOnlyLabelsCheckBox);
  49. DDX_Control(pDX, IDC_CHECK_AUTO_DISABLE_CHILDREN_ITEMS, m_wndAutoDisableChildrenItems);
  50. DDX_Control(pDX, IDC_MYBUTTON2, m_buttonUp );
  51. DDX_Control(pDX, IDC_MYBUTTON1, m_buttonDown );
  52. DDX_Control(pDX, IDC_BUTTON_TREE_BOX_XP, m_buttonLoadTreeBoxXP );
  53. DDX_Control(pDX, IDC_BUTTON_TREE_BOX_VISTA_SET, m_buttonLoadTreeBoxVista );
  54. //}}AFX_DATA_MAP
  55. DDX_Control( pDX, IDC_TREE1, m_wndTree );
  56. }
  57. BEGIN_MESSAGE_MAP(CPageTreeCtrl, CPageBase)
  58. //{{AFX_MSG_MAP(CPageTreeCtrl)
  59. ON_NOTIFY( TVN_SELCHANGED, IDC_TREE1, OnSelChangedTree1 )
  60. ON_BN_CLICKED(IDC_MYBUTTON1, OnBnClickedMybutton1)
  61. ON_BN_CLICKED(IDC_MYBUTTON2, OnBnClickedMybutton2)
  62. ON_BN_CLICKED(IDC_CHECK_FULL_ROW_SELECT, OnBnClickedCheckFullRowSelect)
  63. ON_BN_CLICKED(IDC_CHECK_HAS_BUTTONS, OnBnClickedCheckHasButtons)
  64. ON_BN_CLICKED(IDC_CHECK_HAS_LINES, OnBnClickedCheckHasLines)
  65. ON_BN_CLICKED(IDC_CHECK_LINES_AT_ROOT, OnBnClickedCheckLineSatRoot)
  66. ON_BN_CLICKED(IDC_CHECK_SHOW_SEL_ALWAYS, OnBnClickedCheckShowSelAlways)
  67. ON_BN_CLICKED(IDC_CHECK_SINGLE_EXPAND, OnBnClickedCheckSingleExpand)
  68. ON_BN_CLICKED(IDC_CHECK_TRACK_SELECT, OnBnClickedCheckTrackSelect)
  69. ON_WM_SIZE()
  70. ON_BN_CLICKED(IDC_CHECK_MULTIPLE_SELECTION, OnBnClickedCheckMultipleSelection)
  71. ON_BN_CLICKED(IDC_CHECK_FOCUS_DISABLE_ITEMS, OnBnClickedCheckFocusDisableItems)
  72. ON_BN_CLICKED(IDC_CHECK_SELECT_DISABLE_ITEMS, OnBnClickedCheckSelectDisableItems)
  73. ON_BN_CLICKED(IDC_CHECK_SELECT_COLLAPSED_ITEMS, OnBnClickedCheckSelectCollapsedItems)
  74. ON_BN_CLICKED(IDC_CHECK_SUBTRACT_SELECTION, OnBnClickedCheckSubtractSelection)
  75. ON_BN_CLICKED(IDC_CHECK_HOVER_DISABLE_ITEMS, OnBnClickedCheckHoverDisableItems)
  76. ON_BN_CLICKED(IDC_CHECK_HOVER_TREE_BOX_EX, OnBnClickedCheckHoverTreeBoxEx)
  77. ON_BN_CLICKED(IDC_CHECK_HOVER_CHECK_BOX_EX, OnBnClickedCheckHoverCheckBoxEx)
  78. ON_BN_CLICKED(IDC_CHECK_HOVER_RADIO_BOX_EX, OnBnClickedCheckHoverRadioBoxEx)
  79. ON_BN_CLICKED(IDC_BUTTON_TREE_BOX_XP, OnBnClickedButtonTreeBoxXp)
  80. ON_BN_CLICKED(IDC_BUTTON_TREE_BOX_VISTA_SET, OnBnClickedButtonTreeBoxVistaSet)
  81. ON_BN_CLICKED(IDC_CHECK_SOLID_OUTLINE, OnBnClickedCheckSolidOutline)
  82. ON_BN_CLICKED(IDC_CHECK_TREE_BOX_BITMAP, OnBnClickedCheckTreeBoxBitmap)
  83. ON_BN_CLICKED(IDC_CHECK_TREE_BOX_SQUARE, OnBnClickedCheckTreeBoxSquare)
  84. ON_BN_CLICKED(IDC_CHECK_TREE_BOX_ROUND, OnBnClickedCheckTreeBoxRound)
  85. ON_WM_TIMER()
  86. ON_BN_CLICKED(IDC_CHECK_AUTO_DISABLE_CHILDREN_ITEMS, OnBnClickedCheckAutoDisableChildrenItems)
  87. ON_BN_CLICKED(IDC_CHECK_INFO_TIP, OnBnClickedCheckInfoTip)
  88. ON_BN_CLICKED(IDC_CHECK_EDIT_LABELS, OnBnClickedCheckEditLabels)
  89. ON_BN_CLICKED(IDC_CHECK_READ_ONLY_LABELS, OnBnClickedCheckReadOnlyLabels)
  90. ON_NOTIFY(TVN_BEGINDRAG, IDC_TREE1, OnBegindragTree1)
  91. ON_NOTIFY(TVN_BEGINRDRAG, IDC_TREE1, OnBeginRdragTree1)
  92. ON_NOTIFY(TVN_GETDISPINFO, IDC_TREE1, OnGetdispinfoTree1)
  93. ON_NOTIFY(TVN_ITEMEXPANDING, IDC_TREE1, OnItemexpandingTree1)
  94. ON_NOTIFY(TVN_ITEMEXPANDED, IDC_TREE1, OnItemexpandedTree1)
  95. ON_NOTIFY(TVN_BEGINLABELEDIT, IDC_TREE1, OnBeginlabeleditTree1)
  96. ON_NOTIFY(TVN_ENDLABELEDIT, IDC_TREE1, OnEndlabeleditTree1)
  97. //}}AFX_MSG_MAP
  98. END_MESSAGE_MAP()
  99. /////////////////////////////////////////////////////////////////////////////
  100. // CPageTreeCtrl message handlers
  101. BOOL CPageTreeCtrl::OnInitDialog() 
  102. {
  103. CPageBase::OnInitDialog();
  104. //m_wndTree.OutlineColorSet( RGB(0,128,0) );
  105. //m_wndTree.ExpandCollapseButtonFillColorSet( RGB(200,165,134) );
  106. //m_wndTree.ExpandCollapseButtonSignColorSet( RGB(145,0,0) );
  107. m_wndTree.TreeBoxStyleSet(CExtTreeCtrl::tree_box_style_bitmap);
  108. //m_wndTree.TreeBoxStyleSet(CExtTreeCtrl::tree_box_style_round);
  109. //m_wndTree.OutlineStyleSet(CExtTreeCtrl::outline_style_solid);
  110. //m_wndTree.TreeBkColorSet( RGB(255, 123, 12) );
  111. //  //  //  HTREEITEM hTrRoot;
  112. //  //  //  HTREEITEM hTrAfterRoot;
  113. //  //  //  HTREEITEM hTrLeaf;
  114. //  //  //  CExtCmdIcon _icon;
  115. //  //  //  _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA3) );
  116. //  //  //  _icon.m_bmpNormal.Scale( 16, 16 );
  117. //  //  //  m_wndTree.TreeIconAdd( _icon );
  118. // //m_wndTree.OuterMarginCheckBoxLeftSet( 4 );
  119. // m_wndTree.OuterMarginCheckBoxRightSet( 4 );
  120. // //m_wndTree.OuterMarginIconLeftSet( 4 );
  121. // m_wndTree.OuterMarginIconRightSet( 4 );
  122. // //m_wndTree.OuterMarginLabelLeftSet( 4 );
  123. // m_wndTree.OuterMarginLabelRightSet( 4 );
  124. // //m_wndTree.OuterMarginControlLabelLeftSet( 4 );
  125. // m_wndTree.OuterMarginControlLabelRightSet( 4 );
  126. // m_wndTree.PaddingLabelLeftSet( 5 );
  127. // m_wndTree.PaddingLabelRightSet( 5 );
  128. m_wndTree.LoadWinVistaTreeBox();
  129. // m_wndTree.LoadWinXPTreeBox();
  130. HTREEITEM htiControls, hti;
  131. HTREEITEM htiTextCallBack = m_wndTree.InsertItem( LPSTR_TEXTCALLBACK, NULL, NULL );
  132. ASSERT( htiTextCallBack != NULL );
  133. htiTextCallBack;
  134. htiControls = m_wndTree.InsertItem( _T("Tree items demonstrating supported features"), NULL, NULL );
  135. hti = m_wndTree.InsertItem( _T("Edit control:   "), htiControls, NULL );
  136. m_wndTree.TreeItemInfoGet( hti ).m_eICT =  CExtTreeCtrl::__EICT_EDIT;
  137. m_wndTree.TreeItemInfoGet( hti ).m_strEditText = _T("control text");
  138. m_wndTree.TreeItemInfoGet( hti ).m_nControlWidth = 200;
  139. hti = m_wndTree.InsertItem( _T("Dropdown combobox control:   "), htiControls, NULL );
  140. m_wndTree.TreeItemInfoGet( hti ).m_eICT =  CExtTreeCtrl::__EICT_DROPDOWN_COMBOBOX;
  141. m_wndTree.TreeItemInfoGet( hti ).m_strEditText = _T("Line 1");
  142. m_wndTree.TreeItemInfoGet( hti ).m_nControlWidth = 200;
  143. m_wndTree.TreeItemInfoGet( hti ).ComboBoxItem_Add( new CExtTreeCtrl::COMBOBOXITEMDATA_t( _T("Line 1") ), false );
  144. m_wndTree.TreeItemInfoGet( hti ).ComboBoxItem_Add( new CExtTreeCtrl::COMBOBOXITEMDATA_t( _T("Line 2") ), false );
  145. m_wndTree.TreeItemInfoGet( hti ).ComboBoxItem_Add( new CExtTreeCtrl::COMBOBOXITEMDATA_t( _T("Line 3") ), false );
  146. hti = m_wndTree.InsertItem( _T("Droplist combobox control:   "), htiControls, NULL );
  147. m_wndTree.TreeItemInfoGet( hti ).m_eICT =  CExtTreeCtrl::__EICT_DROPLIST_COMBOBOX;
  148. m_wndTree.TreeItemInfoGet( hti ).m_strEditText = _T("Line 1");
  149. m_wndTree.TreeItemInfoGet( hti ).m_nControlWidth = 200;
  150. m_wndTree.TreeItemInfoGet( hti ).ComboBoxItem_Add( new CExtTreeCtrl::COMBOBOXITEMDATA_t( _T("Line 1") ), false );
  151. m_wndTree.TreeItemInfoGet( hti ).ComboBoxItem_Add( new CExtTreeCtrl::COMBOBOXITEMDATA_t( _T("Line 2") ), false );
  152. m_wndTree.TreeItemInfoGet( hti ).ComboBoxItem_Add( new CExtTreeCtrl::COMBOBOXITEMDATA_t( _T("Line 3") ), false );
  153. HTREEITEM htiProgressBars = m_wndTree.InsertItem( _T("Progress controls"), htiControls, NULL );
  154. hti = m_wndTree.InsertItem( _T("Progress bar with boxes:   "), htiProgressBars, NULL );
  155. m_wndTree.TreeItemInfoGet( hti ).m_eICT =  CExtTreeCtrl::__EICT_PROGRESS_BAR_WITH_BOXES;
  156. m_wndTree.TreeItemInfoGet( hti ).m_nControlWidth = 200;
  157. m_listTreeItemsWithProgressControl.AddTail( hti );
  158. hti = m_wndTree.InsertItem( _T("Smooth progress bar:   "), htiProgressBars, NULL );
  159. m_wndTree.TreeItemInfoGet( hti ).m_eICT =  CExtTreeCtrl::__EICT_PROGRESS_BAR_SMOOTH;
  160. m_wndTree.TreeItemInfoGet( hti ).m_nControlWidth = 200;
  161. m_listTreeItemsWithProgressControl.AddTail( hti );
  162. hti = m_wndTree.InsertItem( _T("Themed progress bar:   "), htiProgressBars, NULL );
  163. m_wndTree.TreeItemInfoGet( hti ).m_eICT =  CExtTreeCtrl::__EICT_PROGRESS_BAR_THEMED;
  164. m_wndTree.TreeItemInfoGet( hti ).m_nControlWidth = 200;
  165. m_listTreeItemsWithProgressControl.AddTail( hti );
  166. hti = m_wndTree.InsertItem( _T("Endless progress bar:   "), htiProgressBars, NULL );
  167. m_wndTree.TreeItemInfoGet( hti ).m_eICT =  CExtTreeCtrl::__EICT_PROGRESS_BAR_ENDLESS;
  168. m_wndTree.TreeItemInfoGet( hti ).m_nControlWidth = 200;
  169. m_listTreeItemsWithProgressControl.AddTail( hti );
  170. m_wndTree.Expand( htiProgressBars, TVE_EXPAND );
  171. HTREEITEM htiCheckBoxes = m_wndTree.InsertItem( _T("Check boxes"), htiControls, NULL );
  172. hti = m_wndTree.InsertItem( _T("Two-state check box"), htiCheckBoxes, NULL );
  173. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_check_box;
  174. hti = m_wndTree.InsertItem( _T("Three-state check box"), htiCheckBoxes, NULL );
  175. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_tri_state_check_box;
  176. m_wndTree.Expand( htiCheckBoxes, TVE_EXPAND );
  177. HTREEITEM htiRadio = m_wndTree.InsertItem( _T("Radio groups"), htiControls, NULL );
  178. //m_wndTree.SetInsertMark( htiRadio, false );
  179. hti = m_wndTree.InsertItem( _T("GroupA-radio1"), htiRadio, NULL );
  180. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_radio;
  181. m_wndTree.TreeItemInfoGet( hti ).m_strRadioGroupName = _T("A");
  182. m_wndTree.TreeItemInfoGet( hti ).m_nCheckBoxState = 1;
  183. hti = m_wndTree.InsertItem( _T("GroupA-radio2"), htiRadio, NULL );
  184. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_radio;
  185. m_wndTree.TreeItemInfoGet( hti ).m_strRadioGroupName = _T("A");
  186. hti = m_wndTree.InsertItem( _T("GroupA-radio3 (disabled)"), htiRadio, NULL );
  187. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_radio;
  188. m_wndTree.TreeItemInfoGet( hti ).m_strRadioGroupName = _T("A");
  189. m_wndTree.TreeItemInfoGet( hti ).m_bDisabled = true;
  190. hti = m_wndTree.InsertItem( _T("GroupA-radio4"), htiRadio, NULL );
  191. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_radio;
  192. m_wndTree.TreeItemInfoGet( hti ).m_strRadioGroupName = _T("A");
  193. hti = m_wndTree.InsertItem( _T("GroupB-radio1"), htiRadio, NULL );
  194. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_radio;
  195. m_wndTree.TreeItemInfoGet( hti ).m_strRadioGroupName = _T("B");
  196. m_wndTree.TreeItemInfoGet( hti ).m_nCheckBoxState = 1;
  197. hti = m_wndTree.InsertItem( _T("GroupB-radio2"), htiRadio, NULL );
  198. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_radio;
  199. m_wndTree.TreeItemInfoGet( hti ).m_strRadioGroupName = _T("B");
  200. hti = m_wndTree.InsertItem( _T("GroupB-radio3 (disabled)"), htiRadio, NULL );
  201. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_radio;
  202. m_wndTree.TreeItemInfoGet( hti ).m_strRadioGroupName = _T("B");
  203. m_wndTree.TreeItemInfoGet( hti ).m_bDisabled = true;
  204. hti = m_wndTree.InsertItem( _T("GroupB-radio4"), htiRadio, NULL );
  205. m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_radio;
  206. m_wndTree.TreeItemInfoGet( hti ).m_strRadioGroupName = _T("B");
  207. m_wndTree.Expand( htiRadio, TVE_EXPAND );
  208. HTREEITEM htiFontEffects = m_wndTree.InsertItem( _T("Font effects"), htiControls, NULL );
  209. hti = m_wndTree.InsertItem( _T("Simple text"), htiFontEffects, NULL );
  210. hti = m_wndTree.InsertItem( _T("Bold text"), htiFontEffects, NULL );
  211.   m_wndTree.TreeItemInfoGet( hti ).m_bBold = true;
  212. hti = m_wndTree.InsertItem( _T("Italic text"), htiFontEffects, NULL );
  213.   m_wndTree.TreeItemInfoGet( hti ).m_bItalic = true;
  214. hti = m_wndTree.InsertItem( _T("Underlined text"), htiFontEffects, NULL );
  215.   m_wndTree.TreeItemInfoGet( hti ).m_bUnderline = true;
  216. hti = m_wndTree.InsertItem( _T("Bold/italic text"), htiFontEffects, NULL );
  217.   m_wndTree.TreeItemInfoGet( hti ).m_bBold = true;
  218.   m_wndTree.TreeItemInfoGet( hti ).m_bItalic = true;
  219. hti = m_wndTree.InsertItem( _T("Bold/underlined text"), htiFontEffects, NULL );
  220.   m_wndTree.TreeItemInfoGet( hti ).m_bBold = true;
  221.   m_wndTree.TreeItemInfoGet( hti ).m_bUnderline = true;
  222. hti = m_wndTree.InsertItem( _T("Italic/underlined text"), htiFontEffects, NULL );
  223.   m_wndTree.TreeItemInfoGet( hti ).m_bUnderline = true;
  224.   m_wndTree.TreeItemInfoGet( hti ).m_bItalic = true;
  225. hti = m_wndTree.InsertItem( _T("Bold/italic/underlined text"), htiFontEffects, NULL );
  226.   m_wndTree.TreeItemInfoGet( hti ).m_bBold = true;
  227.   m_wndTree.TreeItemInfoGet( hti ).m_bItalic = true;
  228.   m_wndTree.TreeItemInfoGet( hti ).m_bUnderline = true;
  229. m_wndTree.Expand( htiFontEffects, TVE_EXPAND );
  230. HTREEITEM htiColorEffects = m_wndTree.InsertItem( _T("Color effects"), htiControls, NULL );
  231. hti = m_wndTree.InsertItem( _T("Simple text"), htiColorEffects, NULL );
  232. hti = m_wndTree.InsertItem( _T("Bold text"), htiColorEffects, NULL );
  233.   m_wndTree.TreeItemInfoGet( hti ).m_bBold = true;
  234.   m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal = RGB(255,0,0);
  235. m_wndTree.TreeItemInfoGet( hti ).m_clrTextHover =
  236. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, +0.25 );
  237. m_wndTree.TreeItemInfoGet( hti ).m_clrTextSelected =
  238. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, -0.25 );
  239. hti = m_wndTree.InsertItem( _T("Italic text"), htiColorEffects, NULL );
  240.   m_wndTree.TreeItemInfoGet( hti ).m_bItalic = true;
  241.   m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal = RGB(0,255,0);
  242. m_wndTree.TreeItemInfoGet( hti ).m_clrTextHover =
  243. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, +0.25 );
  244. m_wndTree.TreeItemInfoGet( hti ).m_clrTextSelected =
  245. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, -0.25 );
  246. hti = m_wndTree.InsertItem( _T("Underlined text"), htiColorEffects, NULL );
  247.   m_wndTree.TreeItemInfoGet( hti ).m_bUnderline = true;
  248.   m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal = RGB(0,0,255);
  249. m_wndTree.TreeItemInfoGet( hti ).m_clrTextHover =
  250. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, +0.25 );
  251. m_wndTree.TreeItemInfoGet( hti ).m_clrTextSelected =
  252. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, -0.25 );
  253. hti = m_wndTree.InsertItem( _T("Bold/italic text"), htiColorEffects, NULL );
  254.   m_wndTree.TreeItemInfoGet( hti ).m_bBold = true;
  255.   m_wndTree.TreeItemInfoGet( hti ).m_bItalic = true;
  256.   m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal = RGB(0,0,255);
  257. m_wndTree.TreeItemInfoGet( hti ).m_clrTextHover =
  258. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, +0.25 );
  259. m_wndTree.TreeItemInfoGet( hti ).m_clrTextSelected =
  260. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, -0.25 );
  261. hti = m_wndTree.InsertItem( _T("Bold/underlined text"), htiColorEffects, NULL );
  262.   m_wndTree.TreeItemInfoGet( hti ).m_bBold = true;
  263.   m_wndTree.TreeItemInfoGet( hti ).m_bUnderline = true;
  264.   m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal = RGB(255,255,0);
  265. m_wndTree.TreeItemInfoGet( hti ).m_clrTextHover =
  266. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, +0.25 );
  267. m_wndTree.TreeItemInfoGet( hti ).m_clrTextSelected =
  268. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, -0.25 );
  269. hti = m_wndTree.InsertItem( _T("Italic/underlined text"), htiColorEffects, NULL );
  270.   m_wndTree.TreeItemInfoGet( hti ).m_bUnderline = true;
  271.   m_wndTree.TreeItemInfoGet( hti ).m_bItalic = true;
  272.   m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal = RGB(0,255,255);
  273. m_wndTree.TreeItemInfoGet( hti ).m_clrTextHover =
  274. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, +0.25 );
  275. m_wndTree.TreeItemInfoGet( hti ).m_clrTextSelected =
  276. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, -0.25 );
  277. hti = m_wndTree.InsertItem( _T("Bold/italic/underlined text"), htiColorEffects, NULL );
  278.   m_wndTree.TreeItemInfoGet( hti ).m_bBold = true;
  279.   m_wndTree.TreeItemInfoGet( hti ).m_bItalic = true;
  280.   m_wndTree.TreeItemInfoGet( hti ).m_bUnderline = true;
  281.   m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal = RGB(192,192,192);
  282. m_wndTree.TreeItemInfoGet( hti ).m_clrTextHover =
  283. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, +0.25 );
  284. m_wndTree.TreeItemInfoGet( hti ).m_clrTextSelected =
  285. CExtBitmap::stat_HLS_Adjust( m_wndTree.TreeItemInfoGet( hti ).m_clrTextNormal, 0.0, -0.25 );
  286. m_wndTree.Expand( htiColorEffects, TVE_EXPAND );
  287. CExtCmdIcon _icon;
  288. CExtBitmap::Filter _f( CExtBitmap::Filter::lanczos );
  289. _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA3) );
  290. _icon.m_bmpNormal.Scale( 16, 16, _f );
  291. m_wndTree.TreeIconAdd( _icon );
  292. _icon.m_bmpNormal.MakeMono( RGB(192,192,192) );
  293. m_wndTree.TreeIconAdd( _icon );
  294. _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA1) );
  295. _icon.m_bmpNormal.Scale( 16, 16, _f );
  296. m_wndTree.TreeIconAdd( _icon );
  297. _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA2) );
  298. _icon.m_bmpNormal.Scale( 16, 16, _f );
  299. m_wndTree.TreeIconAdd( _icon );
  300. _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA4) );
  301. _icon.m_bmpNormal.Scale( 16, 16, _f );
  302. m_wndTree.TreeIconAdd( _icon );
  303. _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA5) );
  304. _icon.m_bmpNormal.Scale( 16, 16, _f );
  305. m_wndTree.TreeIconAdd( _icon );
  306. _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA6) );
  307. _icon.m_bmpNormal.Scale( 16, 16, _f );
  308. m_wndTree.TreeIconAdd( _icon );
  309. _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA7) );
  310. _icon.m_bmpNormal.Scale( 16, 16, _f );
  311. m_wndTree.TreeIconAdd( _icon );
  312. _icon.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(IDB_BITMAP_VISTA8) );
  313. _icon.m_bmpNormal.Scale( 16, 16, _f );
  314. m_wndTree.TreeIconAdd( _icon );
  315. HTREEITEM htiItemsWithIcons = m_wndTree.InsertItem( _T("Items with icons"), htiControls, NULL );
  316. m_wndTree.TreeItemInfoGet( htiItemsWithIcons ).m_nIconIndexCollapsed = 1;
  317. m_wndTree.TreeItemInfoGet( htiItemsWithIcons ).m_nIconIndexExpanded = 0;
  318. hti = m_wndTree.InsertItem( _T("Item 0"), htiItemsWithIcons, NULL );
  319. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexCollapsed = 2;
  320. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexExpanded = 2;
  321. hti = m_wndTree.InsertItem( _T("Item 1"), htiItemsWithIcons, NULL );
  322. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexCollapsed = 3;
  323. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexExpanded = 3;
  324. hti = m_wndTree.InsertItem( _T("Item 2"), htiItemsWithIcons, NULL );
  325. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexCollapsed = 4;
  326. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexExpanded = 4;
  327. hti = m_wndTree.InsertItem( _T("Item 3"), htiItemsWithIcons, NULL );
  328. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexCollapsed = 5;
  329. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexExpanded = 5;
  330. hti = m_wndTree.InsertItem( _T("Item 4"), htiItemsWithIcons, NULL );
  331. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexCollapsed = 6;
  332. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexExpanded = 6;
  333. hti = m_wndTree.InsertItem( _T("Item 5"), htiItemsWithIcons, NULL );
  334. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexCollapsed = 7;
  335. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexExpanded = 7;
  336. hti = m_wndTree.InsertItem( _T("Item 6 (disabled)"), htiItemsWithIcons, NULL );
  337. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexCollapsed = 8;
  338. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexExpanded = 8;
  339. m_wndTree.TreeItemInfoGet( hti ).m_bDisabled = true;
  340. hti = m_wndTree.InsertItem( _T("Item 7"), htiItemsWithIcons, NULL );
  341. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexCollapsed = 8;
  342. m_wndTree.TreeItemInfoGet( hti ).m_nIconIndexExpanded = 8;
  343. m_wndTree.Expand( htiItemsWithIcons, TVE_EXPAND );
  344. m_wndTree.Expand( htiControls, TVE_EXPAND );
  345. m_wndTree.TreeModifyStyle(
  346. __EXT_TREE_MULTIPLE_SELECTION
  347. //|__EXT_TREE_FOCUS_DISABLE_ITEMS
  348. //|__EXT_TREE_SELECT_DISABLE_ITEMS
  349. |__EXT_TREE_SELECT_COLLAPSED_ITEMS
  350. |__EXT_TREE_SUBTRACT_SELECTION
  351. |__EXT_TREE_HOVER_DISABLE_ITEMS
  352. |__EXT_TREE_AUTO_DISABLE_ITEMS_BY_PARENT
  353. );
  354. m_wndTree.TreeModifyStyleEx( 
  355. __EXT_TREE_EX_HOVER_TREE_BOXES 
  356. | __EXT_TREE_EX_HOVER_CHECK_BOXES
  357. | __EXT_TREE_EX_HOVER_RADIO_BUTTONS
  358. );
  359. m_wndTree.ModifyStyle(
  360. 0,
  361. TVS_INFOTIP //|TVS_EDITLABELS
  362. );
  363. m_wndHasButtonsCheckBox.SetCheck( 1 );
  364. m_wndHasLinesCheckBox.SetCheck( 0 );
  365. m_wndLineSatRoot.SetCheck( 1 );
  366. m_wndShowSelAlwaysCheckBox.SetCheck( 1 );
  367. m_wndHoverDisableItemsCheckBox.SetCheck( 1 );;
  368. m_wndHoverTreeBoxExCheckBox.SetCheck( 1 );
  369. m_wndHoverCheckBoxExCheckBox.SetCheck( 1 );
  370. m_wndHoverRadioBoxExCheckBox.SetCheck( 1 );
  371. m_wndMultipleSelectionCheckBox.SetCheck( 1 );
  372. m_wndFocusDisableItemsCheckBox.SetCheck( 0 );
  373. m_wndSelectDisableItemsCheckBox.SetCheck( 0 );
  374. m_wndSelectCollapsedItemsCheckBox.SetCheck( 1 );
  375. m_wndSubtractSelectionCheckBox.SetCheck( 1 );
  376. m_wndTreeBoxBitmapCheckBox.SetCheck( 1 );
  377. m_wndAutoDisableChildrenItems.SetCheck( 1 );
  378. m_wndEditLabelsCheckBox.SetCheck( 0 );
  379. m_wndInfoTipCheckBox.SetCheck( 1 );
  380. OnBnClickedCheckHasButtons();
  381. OnBnClickedCheckHasLines();
  382. OnBnClickedCheckLineSatRoot();
  383. OnBnClickedCheckShowSelAlways();
  384. OnBnClickedCheckSingleExpand();
  385. OnBnClickedCheckTrackSelect();
  386. AddAnchor( IDC_TREE1, __RDA_LT, __RDA_RB );
  387. AddAnchor( IDC_MYBUTTON1, __RDA_RT );
  388. AddAnchor( IDC_MYBUTTON2, __RDA_RT );
  389. AddAnchor( IDC_CHECK_EXPANDED_ONLY, __RDA_RT );
  390. AddAnchor( IDC_CHECK_FULL_ROW_SELECT, __RDA_RT );
  391. AddAnchor( IDC_CHECK_HAS_BUTTONS, __RDA_RT );
  392. AddAnchor( IDC_CHECK_HAS_LINES, __RDA_RT );
  393. AddAnchor( IDC_CHECK_LINES_AT_ROOT, __RDA_RT );
  394. AddAnchor( IDC_CHECK_SHOW_SEL_ALWAYS, __RDA_RT );
  395. AddAnchor( IDC_CHECK_SINGLE_EXPAND, __RDA_RT );
  396. AddAnchor( IDC_CHECK_TRACK_SELECT, __RDA_RT );
  397. AddAnchor( IDC_CHECK_MULTIPLE_SELECTION, __RDA_RT );
  398. AddAnchor( IDC_CHECK_FOCUS_DISABLE_ITEMS, __RDA_RT );
  399. AddAnchor( IDC_CHECK_SELECT_DISABLE_ITEMS, __RDA_RT );
  400. AddAnchor( IDC_CHECK_SELECT_COLLAPSED_ITEMS, __RDA_RT );
  401. AddAnchor( IDC_CHECK_SUBTRACT_SELECTION, __RDA_RT );
  402. AddAnchor( IDC_CHECK_HOVER_DISABLE_ITEMS, __RDA_RT );
  403. AddAnchor( IDC_CHECK_HOVER_TREE_BOX_EX, __RDA_RT );
  404. AddAnchor( IDC_CHECK_HOVER_CHECK_BOX_EX, __RDA_RT );
  405. AddAnchor( IDC_CHECK_HOVER_RADIO_BOX_EX, __RDA_RT );
  406. AddAnchor( IDC_BUTTON_TREE_BOX_XP, __RDA_RT );
  407. AddAnchor( IDC_BUTTON_TREE_BOX_VISTA_SET, __RDA_RT );
  408. AddAnchor( IDC_CHECK_SOLID_OUTLINE, __RDA_RT );
  409. AddAnchor( IDC_CHECK_TREE_BOX_BITMAP, __RDA_RT );
  410. AddAnchor( IDC_CHECK_TREE_BOX_SQUARE, __RDA_RT );
  411. AddAnchor( IDC_CHECK_TREE_BOX_ROUND, __RDA_RT );
  412. AddAnchor( IDC_CHECK_AUTO_DISABLE_CHILDREN_ITEMS, __RDA_RT );
  413. AddAnchor( IDC_CHECK_EDIT_LABELS, __RDA_RT );
  414. AddAnchor( IDC_CHECK_READ_ONLY_LABELS, __RDA_RT );
  415. AddAnchor( IDC_CHECK_INFO_TIP, __RDA_RT );
  416. RepositionBars( 0, 0xFFFF, 0 );
  417. SetTimer( 7, 25, NULL );
  418. m_bInitComplete = true;
  419. return TRUE;
  420. }
  421. void CPageTreeCtrl::OnSelChangedTree1( NMHDR * pNMHDR, LRESULT * p_lResult )
  422. {
  423. pNMHDR;
  424. p_lResult;
  425. }
  426. void CPageTreeCtrl::OnBnClickedMybutton1()
  427. {
  428. bool bExpandedOnly = ( m_wndCheckBoxExpandedOnly.GetCheck() != 0 ) ? true : false;
  429. HTREEITEM htiSelect = m_wndTree.GetSelectedItem();
  430. if( htiSelect == NULL )
  431. return;
  432. HTREEITEM htiNext = m_wndTree.LinearItemGetNext( htiSelect, bExpandedOnly );
  433. if( htiNext == NULL )
  434. return;
  435. m_wndTree.FocusItem( htiNext, true, true );
  436. }
  437. void CPageTreeCtrl::OnBnClickedMybutton2()
  438. {
  439. bool bExpandedOnly = ( m_wndCheckBoxExpandedOnly.GetCheck() != 0 ) ? true : false;
  440. HTREEITEM htiSelect = m_wndTree.GetSelectedItem();
  441. if( htiSelect == NULL )
  442. return;
  443. HTREEITEM htiPrev = m_wndTree.LinearItemGetPrev( htiSelect, bExpandedOnly );
  444. if( htiPrev == NULL )
  445. return;
  446. m_wndTree.FocusItem( htiPrev, true, true );
  447. }
  448. void CPageTreeCtrl::OnBnClickedCheckFullRowSelect()
  449. {
  450. ASSERT_VALID( this );
  451. if( m_wndFullRowSelectCheckBox.GetCheck() )
  452. m_wndTree.FullRowSelectionSet();
  453. else
  454. m_wndTree.FullRowSelectionSet( false );
  455. m_wndTree.Invalidate();
  456. }
  457. void CPageTreeCtrl::OnBnClickedCheckHasButtons()
  458. {
  459. ASSERT_VALID( this );
  460. if( m_wndHasButtonsCheckBox.GetCheck() )
  461. m_wndTree.HasButtonsSet();
  462. else
  463. m_wndTree.HasButtonsSet( false );
  464. m_wndTree.Invalidate();
  465. }
  466. void CPageTreeCtrl::OnBnClickedCheckHasLines()
  467. {
  468. ASSERT_VALID( this );
  469. if( m_wndHasLinesCheckBox.GetCheck() )
  470. m_wndTree.HasLinesSet();
  471. else
  472. m_wndTree.HasLinesSet( false );
  473. m_wndTree.Invalidate();
  474. }
  475. void CPageTreeCtrl::OnBnClickedCheckLineSatRoot()
  476. {
  477. ASSERT_VALID( this );
  478. if( m_wndLineSatRoot.GetCheck() )
  479. m_wndTree.LinesAtRootSet();
  480. else
  481. m_wndTree.LinesAtRootSet( false );
  482. m_wndTree.Invalidate();
  483. }
  484. void CPageTreeCtrl::OnBnClickedCheckShowSelAlways()
  485. {
  486. ASSERT_VALID( this );
  487. if( m_wndShowSelAlwaysCheckBox.GetCheck() )
  488. m_wndTree.ShowSelectionAlwaysSet();
  489. else
  490. m_wndTree.ShowSelectionAlwaysSet( false );
  491. m_wndTree.Invalidate();
  492. }
  493. void CPageTreeCtrl::OnBnClickedCheckSingleExpand()
  494. {
  495. ASSERT_VALID( this );
  496. if( m_wndSingleExpandCheckBox.GetCheck() )
  497. m_wndTree.SingleExpandSet();
  498. else
  499. m_wndTree.SingleExpandSet( false );
  500. m_wndTree.Invalidate();
  501. }
  502. void CPageTreeCtrl::OnBnClickedCheckTrackSelect()
  503. {
  504. ASSERT_VALID( this );
  505. if( m_wndTrackSelectCheckBox.GetCheck() )
  506. m_wndTree.TrackSelectionSet();
  507. else
  508. m_wndTree.TrackSelectionSet( false );
  509. m_wndTree.Invalidate();
  510. }
  511. void CPageTreeCtrl::OnBnClickedCheckMultipleSelection()
  512. {
  513. ASSERT_VALID( this );
  514. if( m_wndMultipleSelectionCheckBox.GetCheck() )
  515. m_wndTree.MultipleSelectionSet();
  516. else
  517. m_wndTree.MultipleSelectionSet( false );
  518. m_wndTree.Invalidate();
  519. }
  520. void CPageTreeCtrl::OnBnClickedCheckFocusDisableItems()
  521. {
  522. ASSERT_VALID( this );
  523. if( m_wndFocusDisableItemsCheckBox.GetCheck() )
  524. m_wndTree.FocusDisabledItemsSet();
  525. else
  526. m_wndTree.FocusDisabledItemsSet( false );
  527. m_wndTree.Invalidate();
  528. }
  529. void CPageTreeCtrl::OnBnClickedCheckSelectDisableItems()
  530. {
  531. ASSERT_VALID( this );
  532. if( m_wndSelectDisableItemsCheckBox.GetCheck() )
  533. m_wndTree.SelectDisabledItemsSet();
  534. else
  535. m_wndTree.SelectDisabledItemsSet( false );
  536. m_wndTree.Invalidate();
  537. }
  538. void CPageTreeCtrl::OnBnClickedCheckSelectCollapsedItems()
  539. {
  540. ASSERT_VALID( this );
  541. if( m_wndSelectCollapsedItemsCheckBox.GetCheck() )
  542. m_wndTree.SelectCollapsedItemsSet();
  543. else
  544. m_wndTree.SelectCollapsedItemsSet( false );
  545. m_wndTree.Invalidate();
  546. }
  547. void CPageTreeCtrl::OnBnClickedCheckSubtractSelection()
  548. {
  549. ASSERT_VALID( this );
  550. if( m_wndSubtractSelectionCheckBox.GetCheck() )
  551. m_wndTree.SubtractSelectionSet();
  552. else
  553. m_wndTree.SubtractSelectionSet( false );
  554. m_wndTree.Invalidate();
  555. }
  556. void CPageTreeCtrl::OnBnClickedCheckHoverDisableItems()
  557. {
  558. ASSERT_VALID( this );
  559. if( m_wndHoverDisableItemsCheckBox.GetCheck() )
  560. m_wndTree.HoverDisabledItemsSet();
  561. else
  562. m_wndTree.HoverDisabledItemsSet( false );
  563. m_wndTree.Invalidate();
  564. }
  565. void CPageTreeCtrl::OnBnClickedCheckHoverTreeBoxEx()
  566. {
  567. ASSERT_VALID( this );
  568. if( m_wndHoverTreeBoxExCheckBox.GetCheck() )
  569. m_wndTree.HoverTreeBoxesSet();
  570. else
  571. m_wndTree.HoverTreeBoxesSet( false );
  572. m_wndTree.Invalidate();
  573. }
  574. void CPageTreeCtrl::OnBnClickedCheckHoverCheckBoxEx()
  575. {
  576. ASSERT_VALID( this );
  577. if( m_wndHoverCheckBoxExCheckBox.GetCheck() )
  578. m_wndTree.HoverCheckBoxesSet();
  579. else
  580. m_wndTree.HoverCheckBoxesSet( false );
  581. m_wndTree.Invalidate();
  582. }
  583. void CPageTreeCtrl::OnBnClickedCheckHoverRadioBoxEx()
  584. {
  585. ASSERT_VALID( this );
  586. if( m_wndHoverRadioBoxExCheckBox.GetCheck() )
  587. m_wndTree.HoverRadioBoxesSet();
  588. else
  589. m_wndTree.HoverRadioBoxesSet( false );
  590. m_wndTree.Invalidate();
  591. }
  592. void CPageTreeCtrl::OnBnClickedButtonTreeBoxXp()
  593. {
  594. m_wndTree.LoadWinXPTreeBox();
  595. m_wndTree.Invalidate();
  596. }
  597. void CPageTreeCtrl::OnBnClickedButtonTreeBoxVistaSet()
  598. {
  599. m_wndTree.LoadWinVistaTreeBox();
  600. m_wndTree.Invalidate();
  601. }
  602. void CPageTreeCtrl::OnSize(UINT nType, int cx, int cy)
  603. {
  604. CExtResizableDialog::OnSize(nType, cx, cy);
  605. if( nType != SIZE_MINIMIZED )
  606. RepositionBars( 0, 0xFFFF, 0 );
  607. }
  608. void CPageTreeCtrl::OnBnClickedCheckSolidOutline()
  609. {
  610. if( m_wndOutlineSolidCheckBox.GetCheck() )
  611. m_wndTree.LineStyleSet( CExtTreeCtrl::line_style_solid );
  612. else
  613. m_wndTree.LineStyleSet( CExtTreeCtrl::line_style_dots );
  614. m_wndTree.Invalidate();
  615. }
  616. void CPageTreeCtrl::OnBnClickedCheckTreeBoxBitmap()
  617. {
  618. if( m_wndTreeBoxBitmapCheckBox.GetCheck() )
  619. m_wndTree.TreeBoxStyleSet( CExtTreeCtrl::tree_box_style_bitmap );
  620. m_wndTreeBoxRoundCheckBox.SetCheck( 0 );
  621. m_wndTreeBoxSquareCheckBox.SetCheck( 0 );
  622. m_wndTree.Invalidate();
  623. }
  624. void CPageTreeCtrl::OnBnClickedCheckTreeBoxSquare()
  625. {
  626. if( m_wndTreeBoxSquareCheckBox.GetCheck() )
  627. m_wndTree.TreeBoxStyleSet( CExtTreeCtrl::tree_box_style_square );
  628. m_wndTreeBoxRoundCheckBox.SetCheck( 0 );
  629. m_wndTreeBoxBitmapCheckBox.SetCheck( 0 );
  630. m_wndTree.Invalidate();
  631. }
  632. void CPageTreeCtrl::OnBnClickedCheckTreeBoxRound()
  633. {
  634. if( m_wndTreeBoxRoundCheckBox.GetCheck() )
  635. m_wndTree.TreeBoxStyleSet( CExtTreeCtrl::tree_box_style_round );
  636. m_wndTreeBoxBitmapCheckBox.SetCheck( 0 );
  637. m_wndTreeBoxSquareCheckBox.SetCheck( 0 );
  638. m_wndTree.Invalidate();
  639. }
  640. void CPageTreeCtrl::OnTimer( __EXT_MFC_UINT_PTR nIDEvent)
  641. {
  642. if( nIDEvent == 7 )
  643. {
  644. if( m_wndTree.GetSafeHwnd() == NULL )
  645. return;
  646. POSITION pos = m_listTreeItemsWithProgressControl.GetHeadPosition();
  647. bool bAnyControlInvalidated = false;
  648. for( ; pos != NULL; )
  649. {
  650. HTREEITEM hti = m_listTreeItemsWithProgressControl.GetNext( pos );
  651. switch( m_wndTree.TreeItemInfoGet( hti ).m_eICT )
  652. {
  653. case CExtTreeCtrl::__EICT_PROGRESS_BAR_THEMED:
  654. case CExtTreeCtrl::__EICT_PROGRESS_BAR_SMOOTH:
  655. case CExtTreeCtrl::__EICT_PROGRESS_BAR_WITH_BOXES:
  656. case CExtTreeCtrl::__EICT_PROGRESS_BAR_ENDLESS:
  657. {
  658. m_wndTree.TreeItemInfoGet( hti ).m_nProgressPos ++;
  659. if( m_wndTree.TreeItemInfoGet( hti ).m_nProgressPos == m_wndTree.TreeItemInfoGet( hti ).m_nProgressMax )
  660. m_wndTree.TreeItemInfoGet( hti ).m_nProgressPos = m_wndTree.TreeItemInfoGet( hti ).m_nProgressMin;
  661. CRect rcItemControl;
  662. if( m_wndTree.TreeItemRectGet( hti, rcItemControl, CExtTreeCtrl::e_tirt_control ) )
  663. {
  664. m_wndTree.InvalidateRect( &rcItemControl );
  665. bAnyControlInvalidated = true;
  666. }
  667. }
  668. break;
  669. }
  670. }
  671. if( bAnyControlInvalidated )
  672. m_wndTree.UpdateWindow();
  673. return;
  674. }
  675. CExtResizableDialog::OnTimer(nIDEvent);
  676. }
  677. void CPageTreeCtrl::OnBnClickedCheckAutoDisableChildrenItems()
  678. {
  679. ASSERT_VALID( this );
  680. if( m_wndAutoDisableChildrenItems.GetCheck() )
  681. m_wndTree.AutoDisableChildrenItemsSet();
  682. else
  683. m_wndTree.AutoDisableChildrenItemsSet( false );
  684. m_wndTree.Invalidate();
  685. }
  686. void CPageTreeCtrl::OnBnClickedCheckEditLabels()
  687. {
  688. ASSERT_VALID( this );
  689. if( m_wndEditLabelsCheckBox.GetCheck() )
  690. {
  691. if( ( m_wndTree.GetStyle() & TVS_EDITLABELS ) == 0 )
  692. m_wndTree.ModifyStyle( NULL, TVS_EDITLABELS );
  693. }
  694. else
  695. {
  696. if( ( m_wndTree.GetStyle() & TVS_EDITLABELS ) != 0 )
  697. m_wndTree.ModifyStyle( TVS_EDITLABELS, NULL );
  698. }
  699. m_wndTree.Invalidate();
  700. }
  701. void CPageTreeCtrl::OnBnClickedCheckReadOnlyLabels()
  702. {
  703. m_wndTree.ReadOnlyLabelsSet( m_wndReadOnlyLabelsCheckBox.GetCheck() ? true : false );
  704. }
  705. void CPageTreeCtrl::OnBnClickedCheckInfoTip()
  706. {
  707. ASSERT_VALID( this );
  708. if( m_wndInfoTipCheckBox.GetCheck() )
  709. {
  710. if( ( m_wndTree.GetStyle() & TVS_INFOTIP ) == 0 )
  711. m_wndTree.ModifyStyle( NULL, TVS_INFOTIP );
  712. }
  713. else
  714. {
  715. if( ( m_wndTree.GetStyle() & TVS_INFOTIP ) != 0 )
  716. m_wndTree.ModifyStyle( TVS_INFOTIP, NULL );
  717. }
  718. m_wndTree.Invalidate();
  719. }
  720. #endif // ( ! defined __EXT_MFC_NO_TREE_VIEW_CTRL )
  721. void CPageTreeCtrl::OnBegindragTree1(NMHDR* pNMHDR, LRESULT* pResult) 
  722. {
  723. pNMHDR;
  724. //NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
  725. // TODO: Add your control notification handler code here
  726. ::AfxMessageBox( _T("CPageTreeCtrl::OnBegindragTree1") );
  727. *pResult = 0;
  728. }
  729. void CPageTreeCtrl::OnBeginRdragTree1(NMHDR* pNMHDR, LRESULT* pResult) 
  730. {
  731. pNMHDR;
  732. //NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
  733. // TODO: Add your control notification handler code here
  734. ::AfxMessageBox( _T("CPageTreeCtrl::OnBeginRdragTree1") );
  735. *pResult = 0;
  736. }
  737. void CPageTreeCtrl::OnGetdispinfoTree1(NMHDR* pNMHDR, LRESULT* pResult) 
  738. {
  739. ASSERT_VALID( this );
  740. TV_DISPINFO * pTVDispInfo = (TV_DISPINFO*)pNMHDR;
  741. if( ( pTVDispInfo->item.mask & (TVIF_TEXT) ) != 0
  742. && pTVDispInfo->item.pszText != NULL
  743. && pTVDispInfo->item.cchTextMax > 0
  744. )
  745. {
  746. CString str;
  747. str.Format( _T("Item 0x%08X with externally queried text"), pTVDispInfo->item.hItem );
  748. __EXT_MFC_STRNCPY( pTVDispInfo->item.pszText, pTVDispInfo->item.cchTextMax, LPCTSTR(str), str.GetLength() );
  749. }
  750. *pResult = 0;
  751. }
  752. void CPageTreeCtrl::OnItemexpandingTree1(NMHDR* pNMHDR, LRESULT* pResult) 
  753. {
  754. ASSERT_VALID( this );
  755. NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW*)pNMHDR;
  756. pNMTreeView;
  757. *pResult = 0;
  758. }
  759. void CPageTreeCtrl::OnItemexpandedTree1(NMHDR* pNMHDR, LRESULT* pResult) 
  760. {
  761. ASSERT_VALID( this );
  762. NM_TREEVIEW * pNMTreeView = (NM_TREEVIEW*)pNMHDR;
  763. pNMTreeView;
  764. *pResult = 0;
  765. }
  766. void CPageTreeCtrl::OnBeginlabeleditTree1(NMHDR* pNMHDR, LRESULT* pResult) 
  767. {
  768. TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
  769. pTVDispInfo;
  770. *pResult = 0;
  771. }
  772. void CPageTreeCtrl::OnEndlabeleditTree1(NMHDR* pNMHDR, LRESULT* pResult) 
  773. {
  774. TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
  775. pTVDispInfo;
  776. *pResult = 1;
  777. }