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

对话框与窗口

开发平台:

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. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CTabManagerPage dialog
  30. CTabManagerPage::CTabManagerPage()
  31. : CXTPPropertyPage(CTabManagerPage::IDD)
  32. {
  33. //{{AFX_DATA_INIT(CTabManagerPage)
  34. m_nAppearance = xtpTabAppearancePropertyPage2003;
  35. m_nColor = -1;
  36. m_nLayout = -1;
  37. m_nPosition = -1;
  38. m_bFillBackground = FALSE;
  39. m_bBoldSelected = TRUE;
  40. m_bLunaColors = TRUE;
  41. m_bOneNoteColors = TRUE;
  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. }
  54. void CTabManagerPage::DoDataExchange(CDataExchange* pDX)
  55. {
  56. CXTPPropertyPage::DoDataExchange(pDX);
  57. //{{AFX_DATA_MAP(CTabManagerPage)
  58. DDX_Control(pDX, IDC_COMBO_APPEARANCE, m_comboAppearance);
  59. DDX_Control(pDX, IDC_COMBO_POSITION, m_comboPosition);
  60. DDX_Control(pDX, IDC_COMBO_COLOR, m_comboColor);
  61. DDX_CBIndex(pDX, IDC_COMBO_APPEARANCE, m_nAppearance);
  62. DDX_CBIndex(pDX, IDC_COMBO_COLOR, m_nColor);
  63. DDX_CBIndex(pDX, IDC_COMBO_LAYOUT, m_nLayout);
  64. DDX_CBIndex(pDX, IDC_COMBO_POSITION, m_nPosition);
  65. DDX_Check(pDX, IDC_CHECK_BOLD_SELECTED, m_bBoldSelected);
  66. DDX_Check(pDX, IDC_CHECK_LUNA_COLORS, m_bLunaColors);
  67. DDX_Check(pDX, IDC_CHECK_ONENOTE_COLORS, m_bOneNoteColors);
  68. DDX_Check(pDX, IDC_CHECK_HOTTRACKING, m_bHotTracking);
  69. DDX_Check(pDX, IDC_CHECK_ICONS, m_bShowIcons);
  70. //}}AFX_DATA_MAP
  71. }
  72. BEGIN_MESSAGE_MAP(CTabManagerPage, CXTPPropertyPage)
  73. //{{AFX_MSG_MAP(CTabManagerPage)
  74. ON_CBN_SELCHANGE(IDC_COMBO_COLOR, OnSelchangeComboColor)
  75. ON_CBN_SELCHANGE(IDC_COMBO_POSITION, OnSelchangeComboPosition)
  76. ON_CBN_SELCHANGE(IDC_COMBO_APPEARANCE, OnSelchangeComboAppearance)
  77. ON_BN_CLICKED(IDC_CHECK_BOLD_SELECTED, OnCheckBoldSelected)
  78. ON_BN_CLICKED(IDC_CHECK_LUNA_COLORS, OnCheckLunaColors)
  79. ON_BN_CLICKED(IDC_CHECK_ONENOTE_COLORS, OnCheckOnenoteColors)
  80. ON_BN_CLICKED(IDC_CHECK_HOTTRACKING, OnCheckHottracking)
  81. ON_BN_CLICKED(IDC_CHECK_ICONS, OnCheckIcons)
  82. ON_CBN_SELCHANGE(IDC_COMBO_LAYOUT, OnSelchangeComboLayout)
  83. //}}AFX_MSG_MAP
  84. END_MESSAGE_MAP()
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CTabManagerPage message handlers
  87. BOOL CTabManagerPage::OnInitDialog()
  88. {
  89. CXTPPropertyPage::OnInitDialog();
  90. // Initialize OneNote style tabs.
  91. //GetPaintManager()->SetAppearance((XTPTabAppearanceStyle)m_nAppearance);
  92. //GetPaintManager()->DisableLunaColors(!m_bLunaColors);
  93. //GetPaintManager()->SetOneNoteColors(m_bOneNoteColors);
  94. Update();
  95. m_comboPosition.SetItemData(0, xtpTabPositionTop);
  96. m_comboPosition.SetItemData(1, xtpTabPositionLeft);
  97. m_comboPosition.SetItemData(2, xtpTabPositionBottom);
  98. m_comboPosition.SetItemData(3, xtpTabPositionRight);
  99. return TRUE;  // return TRUE  unless you set the focus to a control
  100. }
  101. void CTabManagerPage::Update()
  102. {
  103. m_nAppearance = GetPaintManager()->GetAppearance();
  104. m_nColor = 1;
  105. m_bFillBackground = GetPaintManager()->m_bFillBackground;
  106. m_nLayout = GetPaintManager()->GetLayout();
  107. m_nPosition = GetPaintManager()->GetPosition();
  108. m_bBoldSelected = GetPaintManager()->m_bBoldSelected;
  109. m_bLunaColors = !GetPaintManager()->IsLunaColorsDisabled();
  110. m_bOneNoteColors = GetPaintManager()->m_bOneNoteColors;
  111. m_bHotTracking = GetPaintManager()->m_bHotTracking;
  112. m_bShowStaticFrame = GetPaintManager()->m_bStaticFrame;
  113. CXTPTabManager* pManager = GetManager();
  114. if (pManager)
  115. {
  116. m_nArrows = pManager->FindNavigateButton(xtpTabNavigateButtonLeft)->GetFlags();
  117. m_nClose = pManager->FindNavigateButton(xtpTabNavigateButtonClose)->GetFlags();
  118. }
  119. m_nClientFrame = GetPaintManager()->m_clientFrame;
  120. m_bMultiRowFixedSelection = GetPaintManager()->m_bMultiRowFixedSelection;
  121. m_bMultiRowJustified = GetPaintManager()->m_bMultiRowJustified;
  122. UpdateData(FALSE);
  123. UpdateControls();
  124. }
  125. void CTabManagerPage::OnCancel()
  126. {
  127. }
  128. void CTabManagerPage::OnSelchangeComboColor()
  129. {
  130. UpdateData();
  131. XTPTabColorStyle color = (XTPTabColorStyle)m_comboColor.GetItemData(m_nColor);
  132. GetPaintManager()->SetColor(color);
  133. UpdateControls();
  134. Reposition();
  135. }
  136. void CTabManagerPage::OnSelchangeComboPosition()
  137. {
  138. UpdateData();
  139. XTPTabPosition position = (XTPTabPosition)m_comboPosition.GetItemData(m_nPosition);
  140. GetPaintManager()->SetPosition(position);
  141. Reposition();
  142. }
  143. void CTabManagerPage::OnSelchangeComboAppearance()
  144. {
  145. UpdateData();
  146. GetPaintManager()->SetAppearance((XTPTabAppearanceStyle)m_nAppearance);
  147. UpdateControls();
  148. Reposition();
  149. }
  150. void CTabManagerPage::OnSelchangeComboLayout()
  151. {
  152. UpdateData();
  153. GetPaintManager()->SetLayout((XTPTabLayoutStyle)m_nLayout);
  154. UpdateControls();
  155. Reposition();
  156. }
  157. void CTabManagerPage::OnSelchangeComboArrows()
  158. {
  159. UpdateData();
  160. CXTPTabManager* pManager = GetManager();
  161. if (pManager)
  162. {
  163. pManager->FindNavigateButton(xtpTabNavigateButtonLeft)->SetFlags((XTPTabNavigateButtonFlags)m_nArrows);
  164. pManager->FindNavigateButton(xtpTabNavigateButtonRight)->SetFlags((XTPTabNavigateButtonFlags)m_nArrows);
  165. }
  166. Reposition();
  167. }
  168. void CTabManagerPage::OnSelchangeComboClose()
  169. {
  170. UpdateData();
  171. CXTPTabManager* pManager = GetManager();
  172. if (pManager)
  173. {
  174. pManager->FindNavigateButton(xtpTabNavigateButtonClose)->SetFlags((XTPTabNavigateButtonFlags)m_nClose);
  175. }
  176. Reposition();
  177. }
  178. void CTabManagerPage::OnSelchangeComboClientFrame()
  179. {
  180. UpdateData();
  181. GetPaintManager()->m_clientFrame = (XTPTabClientFrame)m_nClientFrame;
  182. Reposition();
  183. }
  184. void CTabManagerPage::UpdateControls()
  185. {
  186. const struct
  187. {
  188. int nColorSet;
  189. LPCTSTR strColorSet;
  190. }
  191. colors[] =
  192. {
  193. xtpTabColorDefault, _T("xtpTabColorDefault"),
  194. xtpTabColorVisualStudio, _T("xtpTabColorVisualStudio"),
  195. xtpTabColorOffice2003, _T("xtpTabColorOffice2003"),
  196. xtpTabColorWinXP, _T("xtpTabColorWinXP"),
  197. xtpTabColorWhidbey, _T("xtpTabColorWhidbey")
  198. };
  199. int nSupported = GetPaintManager()->GetAppearanceSet()->GetSupportedColorSets();
  200. m_comboColor.ResetContent();
  201. for (int i = 0; i < 5; i++)
  202. {
  203. if (nSupported & colors[i].nColorSet)
  204. {
  205. int nItem = m_comboColor.AddString(colors[i].strColorSet);
  206. m_comboColor.SetItemData(nItem, colors[i].nColorSet);
  207. if (GetPaintManager()->GetColor() == colors[i].nColorSet)
  208. {
  209. m_nColor = nItem;
  210. m_comboColor.SetCurSel(nItem);
  211. }
  212. }
  213. }
  214. GetDlgItem(IDC_CHECK_LUNA_COLORS)->EnableWindow((m_comboColor.GetItemData(m_nColor) & (xtpTabColorOffice2003|xtpTabColorWhidbey)) != 0);
  215. GetDlgItem(IDC_CHECK_ONENOTE_COLORS)->EnableWindow(m_comboColor.GetItemData(m_nColor) != xtpTabColorWinXP);
  216. }
  217. void CTabManagerPage::OnCheckBoldSelected()
  218. {
  219. UpdateData();
  220. GetPaintManager()->m_bBoldSelected = m_bBoldSelected;
  221. Reposition();
  222. }
  223. void CTabManagerPage::OnCheckLunaColors()
  224. {
  225. UpdateData();
  226. GetPaintManager()->DisableLunaColors(!m_bLunaColors);
  227. Reposition();
  228. }
  229. void CTabManagerPage::OnCheckOnenoteColors()
  230. {
  231. UpdateData();
  232. GetPaintManager()->SetOneNoteColors(m_bOneNoteColors);
  233. Reposition();
  234. }
  235. void CTabManagerPage::OnCheckHottracking()
  236. {
  237. UpdateData();
  238. GetPaintManager()->m_bHotTracking = m_bHotTracking;
  239. Reposition();
  240. }
  241. void CTabManagerPage::OnCheckIcons()
  242. {
  243. UpdateData();
  244. GetPaintManager()->m_bShowIcons = m_bShowIcons;
  245. Reposition();
  246. }
  247. void CTabManagerPage::OnCheckStaticFrame()
  248. {
  249. UpdateData();
  250. GetPaintManager()->m_bStaticFrame = m_bShowStaticFrame;
  251. Reposition();
  252. }
  253. void CTabManagerPage::OnCheckAllowReorder()
  254. {
  255. UpdateData();
  256. if (GetManager())
  257. GetManager()->SetAllowReorder(m_bAllowReorder);
  258. }
  259. void CTabManagerPage::OnCheckFixedSelection() 
  260. {
  261. UpdateData();
  262. GetPaintManager()->m_bMultiRowFixedSelection = m_bMultiRowFixedSelection;
  263. Reposition();
  264. }
  265. void CTabManagerPage::OnCheckBackground()
  266. {
  267. UpdateData();
  268. GetPaintManager()->m_bFillBackground = m_bFillBackground;
  269. Reposition();
  270. }
  271. void CTabManagerPage::OnCheckJustified() 
  272. {
  273. UpdateData();
  274. GetPaintManager()->m_bMultiRowJustified = m_bMultiRowJustified;
  275. Reposition();
  276. }
  277. //////////////////////////////////////////////////////////////////////////
  278. // CTabControlPage
  279. CTabControlPage::CTabControlPage()
  280. {
  281. m_bShowIcons = FALSE;
  282. m_bAllowReorder = FALSE;
  283. }
  284. CXTPTabManager* CTabControlPage::GetManager()
  285. {
  286. CXTPPropertyPageNavigator* pNavigator = m_pSheet->GetNavigator();
  287. return (CXTPPropertyPageTabNavigator*)pNavigator;
  288. }
  289. void CTabControlPage::Reposition()
  290. {
  291. GetManager()->Reposition();
  292. m_pSheet->RecalcLayout();
  293. m_pSheet->RedrawWindow(0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN| RDW_ERASE);
  294. }