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

对话框与窗口

开发平台:

Visual C++

  1. // AlphaIconsPage.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 "resource.h"
  22. #include "TabClientPage.h"
  23. #include "MainFrm.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CTabManagerPage dialog
  31. CTabManagerPage::CTabManagerPage()
  32. : CXTPPropertyPage(CTabManagerPage::IDD)
  33. {
  34. //{{AFX_DATA_INIT(CTabManagerPage)
  35. m_nAppearance = -1;
  36. m_nColor = -1;
  37. m_nLayout = -1;
  38. m_nPosition = -1;
  39. m_bBoldSelected = TRUE;
  40. m_bLunaColors = FALSE;
  41. m_bOneNoteColors = FALSE;
  42. m_bHotTracking = FALSE;
  43. m_bShowIcons = FALSE;
  44. m_nArrows = -1;
  45. m_nClose = -1;
  46. m_bShowStaticFrame = FALSE;
  47. m_nClientFrame = -1;
  48. m_bAllowReorder = TRUE;
  49. m_bMultiRowFixedSelection = FALSE;
  50. m_bMultiRowJustified = FALSE;
  51. //}}AFX_DATA_INIT
  52. m_bShowIcons = TRUE;
  53. m_bLargeIcons = FALSE;
  54. }
  55. void CTabManagerPage::DoDataExchange(CDataExchange* pDX)
  56. {
  57. CXTPPropertyPage::DoDataExchange(pDX);
  58. //{{AFX_DATA_MAP(CTabManagerPage)
  59. DDX_Control(pDX, IDC_COMBO_APPEARANCE, m_comboAppearance);
  60. DDX_Control(pDX, IDC_COMBO_POSITION, m_comboPosition);
  61. DDX_Control(pDX, IDC_COMBO_COLOR, m_comboColor);
  62. DDX_CBIndex(pDX, IDC_COMBO_APPEARANCE, m_nAppearance);
  63. DDX_CBIndex(pDX, IDC_COMBO_COLOR, m_nColor);
  64. DDX_CBIndex(pDX, IDC_COMBO_LAYOUT, m_nLayout);
  65. DDX_CBIndex(pDX, IDC_COMBO_POSITION, m_nPosition);
  66. DDX_Check(pDX, IDC_CHECK_BOLD_SELECTED, m_bBoldSelected);
  67. DDX_Check(pDX, IDC_CHECK_LUNA_COLORS, m_bLunaColors);
  68. DDX_Check(pDX, IDC_CHECK_ONENOTE_COLORS, m_bOneNoteColors);
  69. DDX_Check(pDX, IDC_CHECK_HOTTRACKING, m_bHotTracking);
  70. DDX_Check(pDX, IDC_CHECK_ICONS, m_bShowIcons);
  71. DDX_CBIndex(pDX, IDC_COMBO_ARROWS, m_nArrows);
  72. DDX_CBIndex(pDX, IDC_COMBO_CLOSE, m_nClose);
  73. DDX_Check(pDX, IDC_CHECK_STATIC_FRAME, m_bShowStaticFrame);
  74. DDX_CBIndex(pDX, IDC_COMBO_CLIENT_FRAME, m_nClientFrame);
  75. DDX_Check(pDX, IDC_CHECK_ALLOW_REORDER, m_bAllowReorder);
  76. DDX_Check(pDX, IDC_CHECK_LARGEICONS, m_bLargeIcons);
  77. DDX_Check(pDX, IDC_CHECK_MULTIROWFIXEDSELECTION, m_bMultiRowFixedSelection);
  78. DDX_Check(pDX, IDC_CHECK_MULTIROWJUSTIFIED, m_bMultiRowJustified);
  79. //}}AFX_DATA_MAP
  80. }
  81. BEGIN_MESSAGE_MAP(CTabManagerPage, CXTPPropertyPage)
  82. //{{AFX_MSG_MAP(CTabManagerPage)
  83. ON_CBN_SELCHANGE(IDC_COMBO_COLOR, OnSelchangeComboColor)
  84. ON_CBN_SELCHANGE(IDC_COMBO_POSITION, OnSelchangeComboPosition)
  85. ON_CBN_SELCHANGE(IDC_COMBO_APPEARANCE, OnSelchangeComboAppearance)
  86. ON_BN_CLICKED(IDC_CHECK_BOLD_SELECTED, OnCheckBoldSelected)
  87. ON_BN_CLICKED(IDC_CHECK_LUNA_COLORS, OnCheckLunaColors)
  88. ON_BN_CLICKED(IDC_CHECK_ONENOTE_COLORS, OnCheckOnenoteColors)
  89. ON_BN_CLICKED(IDC_CHECK_HOTTRACKING, OnCheckHottracking)
  90. ON_BN_CLICKED(IDC_CHECK_ICONS, OnCheckIcons)
  91. ON_CBN_SELCHANGE(IDC_COMBO_LAYOUT, OnSelchangeComboLayout)
  92. ON_CBN_SELCHANGE(IDC_COMBO_ARROWS, OnSelchangeComboArrows)
  93. ON_CBN_SELCHANGE(IDC_COMBO_CLOSE, OnSelchangeComboClose)
  94. ON_BN_CLICKED(IDC_CHECK_STATIC_FRAME, OnCheckStaticFrame)
  95. ON_CBN_SELCHANGE(IDC_COMBO_CLIENT_FRAME, OnSelchangeComboClientFrame)
  96. ON_BN_CLICKED(IDC_CHECK_LARGEICONS, OnCheckLargeIcons)
  97. ON_BN_CLICKED(IDC_CHECK_MULTIROWFIXEDSELECTION, OnCheckFixedSelection)
  98. ON_BN_CLICKED(IDC_CHECK_ALLOW_REORDER, OnCheckAllowReorder)
  99. ON_BN_CLICKED(IDC_CHECK_MULTIROWJUSTIFIED, OnCheckJustified)
  100. //}}AFX_MSG_MAP
  101. END_MESSAGE_MAP()
  102. /////////////////////////////////////////////////////////////////////////////
  103. // CTabManagerPage message handlers
  104. BOOL CTabManagerPage::OnInitDialog()
  105. {
  106. CXTPPropertyPage::OnInitDialog();
  107. Update();
  108. m_comboPosition.SetItemData(0, xtpTabPositionTop);
  109. m_comboPosition.SetItemData(1, xtpTabPositionLeft);
  110. m_comboPosition.SetItemData(2, xtpTabPositionBottom);
  111. m_comboPosition.SetItemData(3, xtpTabPositionRight);
  112. return TRUE;  // return TRUE  unless you set the focus to a control
  113. }
  114. void CTabManagerPage::Update()
  115. {
  116. m_nAppearance = GetPaintManager()->GetAppearance();
  117. m_nColor = 1;
  118. m_nLayout = GetPaintManager()->GetLayout();
  119. m_nPosition = GetPaintManager()->GetPosition();
  120. m_bBoldSelected = GetPaintManager()->m_bBoldSelected;
  121. m_bLunaColors = !GetPaintManager()->IsLunaColorsDisabled();
  122. m_bOneNoteColors = GetPaintManager()->m_bOneNoteColors;
  123. m_bHotTracking = GetPaintManager()->m_bHotTracking;
  124. m_bShowStaticFrame = GetPaintManager()->m_bStaticFrame;
  125. CXTPTabManager* pManager = GetManager();
  126. if (pManager)
  127. {
  128. m_nArrows = pManager->FindNavigateButton(xtpTabNavigateButtonLeft)->GetFlags();
  129. m_nClose = pManager->FindNavigateButton(xtpTabNavigateButtonClose)->GetFlags();
  130. }
  131. m_nClientFrame = GetPaintManager()->m_clientFrame;
  132. m_bMultiRowFixedSelection = GetPaintManager()->m_bMultiRowFixedSelection;
  133. m_bMultiRowJustified = GetPaintManager()->m_bMultiRowJustified;
  134. UpdateData(FALSE);
  135. UpdateControls();
  136. }
  137. void CTabManagerPage::OnCancel()
  138. {
  139. }
  140. void CTabManagerPage::OnSelchangeComboColor()
  141. {
  142. UpdateData();
  143. XTPTabColorStyle color = (XTPTabColorStyle)m_comboColor.GetItemData(m_nColor);
  144. GetPaintManager()->SetColor(color);
  145. UpdateControls();
  146. Reposition();
  147. }
  148. void CTabManagerPage::OnSelchangeComboPosition()
  149. {
  150. UpdateData();
  151. XTPTabPosition position = (XTPTabPosition)m_comboPosition.GetItemData(m_nPosition);
  152. GetPaintManager()->SetPosition(position);
  153. Reposition();
  154. }
  155. void CTabManagerPage::OnSelchangeComboAppearance()
  156. {
  157. UpdateData();
  158. GetPaintManager()->SetAppearance((XTPTabAppearanceStyle)m_nAppearance);
  159. UpdateControls();
  160. Reposition();
  161. }
  162. void CTabManagerPage::OnSelchangeComboLayout()
  163. {
  164. UpdateData();
  165. GetPaintManager()->SetLayout((XTPTabLayoutStyle)m_nLayout);
  166. UpdateControls();
  167. Reposition();
  168. }
  169. void CTabManagerPage::OnSelchangeComboArrows()
  170. {
  171. UpdateData();
  172. CXTPTabManager* pManager = GetManager();
  173. if (pManager)
  174. {
  175. pManager->FindNavigateButton(xtpTabNavigateButtonLeft)->SetFlags((XTPTabNavigateButtonFlags)m_nArrows);
  176. pManager->FindNavigateButton(xtpTabNavigateButtonRight)->SetFlags((XTPTabNavigateButtonFlags)m_nArrows);
  177. }
  178. Reposition();
  179. }
  180. void CTabManagerPage::OnSelchangeComboClose()
  181. {
  182. UpdateData();
  183. CXTPTabManager* pManager = GetManager();
  184. if (pManager)
  185. {
  186. pManager->FindNavigateButton(xtpTabNavigateButtonClose)->SetFlags((XTPTabNavigateButtonFlags)m_nClose);
  187. }
  188. Reposition();
  189. }
  190. void CTabManagerPage::OnSelchangeComboClientFrame()
  191. {
  192. UpdateData();
  193. GetPaintManager()->m_clientFrame = (XTPTabClientFrame)m_nClientFrame;
  194. Reposition();
  195. }
  196. void CTabManagerPage::UpdateControls()
  197. {
  198. const struct
  199. {
  200. int nColorSet;
  201. LPCTSTR strColorSet;
  202. }
  203. colors[] =
  204. {
  205. xtpTabColorDefault, _T("xtpTabColorDefault"),
  206. xtpTabColorVisualStudio, _T("xtpTabColorVisualStudio"),
  207. xtpTabColorOffice2003, _T("xtpTabColorOffice2003"),
  208. xtpTabColorWinXP, _T("xtpTabColorWinXP"),
  209. xtpTabColorWhidbey, _T("xtpTabColorWhidbey"),
  210. xtpTabColorVisualStudio2008, _T("xtpTabColorVisualStudio2008")
  211. };
  212. int nSupported = GetPaintManager()->GetAppearanceSet()->GetSupportedColorSets();
  213. m_comboColor.ResetContent();
  214. for (int i = 0; i < _countof(colors); i++)
  215. {
  216. if (nSupported & colors[i].nColorSet)
  217. {
  218. int nItem = m_comboColor.AddString(colors[i].strColorSet);
  219. m_comboColor.SetItemData(nItem, colors[i].nColorSet);
  220. if (GetPaintManager()->GetColor() == colors[i].nColorSet)
  221. {
  222. m_nColor = nItem;
  223. m_comboColor.SetCurSel(nItem);
  224. }
  225. }
  226. }
  227. GetDlgItem(IDC_CHECK_LUNA_COLORS)->EnableWindow((m_comboColor.GetItemData(m_nColor) & (xtpTabColorOffice2003|xtpTabColorWhidbey)) != 0);
  228. GetDlgItem(IDC_CHECK_ONENOTE_COLORS)->EnableWindow(m_comboColor.GetItemData(m_nColor) != xtpTabColorWinXP);
  229. GetDlgItem(IDC_CHECK_LARGEICONS)->EnableWindow(m_bShowIcons);
  230. GetDlgItem(IDC_CHECK_MULTIROWFIXEDSELECTION)->EnableWindow(m_nLayout == xtpTabLayoutMultiRow);
  231. GetDlgItem(IDC_CHECK_MULTIROWJUSTIFIED)->EnableWindow(m_nLayout == xtpTabLayoutMultiRow);
  232. }
  233. void CTabManagerPage::OnCheckBoldSelected()
  234. {
  235. UpdateData();
  236. GetPaintManager()->m_bBoldSelected = m_bBoldSelected;
  237. Reposition();
  238. }
  239. void CTabManagerPage::OnCheckLunaColors()
  240. {
  241. UpdateData();
  242. GetPaintManager()->DisableLunaColors(!m_bLunaColors);
  243. Reposition();
  244. }
  245. void CTabManagerPage::OnCheckOnenoteColors()
  246. {
  247. UpdateData();
  248. GetPaintManager()->SetOneNoteColors(m_bOneNoteColors);
  249. Reposition();
  250. }
  251. void CTabManagerPage::OnCheckHottracking()
  252. {
  253. UpdateData();
  254. GetPaintManager()->m_bHotTracking = m_bHotTracking;
  255. Reposition();
  256. }
  257. void CTabManagerPage::OnCheckIcons()
  258. {
  259. UpdateData();
  260. GetPaintManager()->m_bShowIcons = m_bShowIcons;
  261. GetDlgItem(IDC_CHECK_LARGEICONS)->EnableWindow(m_bShowIcons);
  262. Reposition();
  263. }
  264. void CTabManagerPage::OnCheckLargeIcons()
  265. {
  266. UpdateData();
  267. GetPaintManager()->m_szIcon = !m_bLargeIcons? CSize(16, 16): CSize(32, 32);
  268. Reposition();
  269. }
  270. void CTabManagerPage::OnCheckStaticFrame()
  271. {
  272. UpdateData();
  273. GetPaintManager()->m_bStaticFrame = m_bShowStaticFrame;
  274. Reposition();
  275. }
  276. void CTabManagerPage::OnCheckAllowReorder()
  277. {
  278. UpdateData();
  279. if (GetManager())
  280. GetManager()->SetAllowReorder(m_bAllowReorder);
  281. }
  282. void CTabManagerPage::OnCheckFixedSelection() 
  283. {
  284. UpdateData();
  285. GetPaintManager()->m_bMultiRowFixedSelection = m_bMultiRowFixedSelection;
  286. Reposition();
  287. }
  288. void CTabManagerPage::OnCheckJustified() 
  289. {
  290. UpdateData();
  291. GetPaintManager()->m_bMultiRowJustified = m_bMultiRowJustified;
  292. Reposition();
  293. }
  294. //////////////////////////////////////////////////////////////////////////
  295. // CTabClientPage
  296. CTabClientPage::CTabClientPage()
  297. {
  298. }
  299. CXTPTabManager* CTabClientPage::GetManager()
  300. {
  301. return NULL;
  302. }
  303. CXTPTabPaintManager* CTabClientPage::GetPaintManager()
  304. {
  305. return ((CMainFrame*)GetParentFrame())->m_MTIClientWnd.GetPaintManager();
  306. }
  307. void CTabClientPage::OnCheckAllowReorder()
  308. {
  309. UpdateData();
  310. ((CMainFrame*)GetParentFrame())->m_MTIClientWnd.SetAllowReorder(m_bAllowReorder);
  311. }
  312. void CTabClientPage::UpdateControls()
  313. {
  314. CTabManagerPage::UpdateControls();
  315. GetDlgItem(IDC_COMBO_ARROWS)->EnableWindow(FALSE);
  316. GetDlgItem(IDC_COMBO_CLOSE)->EnableWindow(FALSE);
  317. }
  318. void CTabClientPage::Reposition()
  319. {
  320. ((CMainFrame*)GetParentFrame())->m_MTIClientWnd.Refresh();
  321. }
  322. //////////////////////////////////////////////////////////////////////////
  323. // CTabControlPage
  324. CTabControlPage::CTabControlPage()
  325. {
  326. m_bShowIcons = FALSE;
  327. m_bAllowReorder = FALSE;
  328. }
  329. CXTPTabManager* CTabControlPage::GetManager()
  330. {
  331. CXTPPropertyPageNavigator* pNavigator = ((CXTPPropertySheet*)GetParent())->GetNavigator();
  332. return (CXTPPropertyPageTabNavigator*)pNavigator;
  333. }
  334. //////////////////////////////////////////////////////////////////////////
  335. // CTabDockingPanePage
  336. CTabDockingPanePage::CTabDockingPanePage()
  337. {
  338. }
  339. CXTPTabPaintManager* CTabDockingPanePage::GetPaintManager()
  340. {
  341. return ((CMainFrame*)GetParentFrame())->m_paneManager.GetPaintManager()->GetTabPaintManager();
  342. }
  343. void CTabDockingPanePage::Reposition()
  344. {
  345. ((CMainFrame*)GetParentFrame())->m_paneManager.RedrawPanes();
  346. }
  347. void CTabDockingPanePage::UpdateControls()
  348. {
  349. CTabManagerPage::UpdateControls();
  350. GetDlgItem(IDC_CHECK_ALLOW_REORDER)->EnableWindow(FALSE);
  351. GetDlgItem(IDC_COMBO_ARROWS)->EnableWindow(FALSE);
  352. GetDlgItem(IDC_COMBO_CLOSE)->EnableWindow(FALSE);
  353. }
  354. //////////////////////////////////////////////////////////////////////////
  355. // CTabPanelPage
  356. CTabPanelPage::CTabPanelPage()
  357. {
  358. }
  359. CXTPTabPaintManager* CTabPanelPage::GetPaintManager()
  360. {
  361. return ((CMainFrame*)GetParentFrame())->m_paneManager.GetPaintManager()->GetPanelPaintManager();
  362. }
  363. void CTabPanelPage::Reposition()
  364. {
  365. ((CMainFrame*)GetParentFrame())->m_paneManager.RedrawPanes();
  366. }
  367. void CTabPanelPage::UpdateControls()
  368. {
  369. CTabManagerPage::UpdateControls();
  370. GetDlgItem(IDC_CHECK_ALLOW_REORDER)->EnableWindow(FALSE);
  371. GetDlgItem(IDC_COMBO_ARROWS)->EnableWindow(FALSE);
  372. GetDlgItem(IDC_COMBO_CLOSE)->EnableWindow(FALSE);
  373. GetDlgItem(IDC_COMBO_POSITION)->EnableWindow(FALSE);
  374. GetDlgItem(IDC_CHECK_STATIC_FRAME)->EnableWindow(FALSE);
  375. GetDlgItem(IDC_COMBO_CLIENT_FRAME)->EnableWindow(FALSE);
  376. }
  377. BOOL CTabPanelPage::OnInitDialog()
  378. {
  379. CTabManagerPage::OnInitDialog();
  380. m_comboAppearance.DeleteString(xtpTabAppearanceVisio);
  381. m_comboAppearance.DeleteString(xtpTabAppearanceVisio);
  382. return TRUE;  // return TRUE  unless you set the focus to a control
  383. }