atlsplit.h 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. // Windows Template Library - WTL version 10.0
  2. // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
  3. //
  4. // This file is a part of the Windows Template Library.
  5. // The use and distribution terms for this software are covered by the
  6. // Microsoft Public License (http://opensource.org/licenses/MS-PL)
  7. // which can be found in the file MS-PL.txt at the root folder.
  8. #ifndef __ATLSPLIT_H__
  9. #define __ATLSPLIT_H__
  10. #pragma once
  11. #ifndef __ATLAPP_H__
  12. #error atlsplit.h requires atlapp.h to be included first
  13. #endif
  14. #ifndef __ATLWIN_H__
  15. #error atlsplit.h requires atlwin.h to be included first
  16. #endif
  17. ///////////////////////////////////////////////////////////////////////////////
  18. // Classes in this file:
  19. //
  20. // CSplitterImpl<T>
  21. // CSplitterWindowImpl<T, TBase, TWinTraits>
  22. // CSplitterWindowT<t_bVertical> - CSplitterWindow, CHorSplitterWindow
  23. namespace WTL
  24. {
  25. ///////////////////////////////////////////////////////////////////////////////
  26. // CSplitterImpl - Provides splitter support to any window
  27. // Splitter panes constants
  28. #define SPLIT_PANE_LEFT 0
  29. #define SPLIT_PANE_RIGHT 1
  30. #define SPLIT_PANE_TOP SPLIT_PANE_LEFT
  31. #define SPLIT_PANE_BOTTOM SPLIT_PANE_RIGHT
  32. #define SPLIT_PANE_NONE -1
  33. // Splitter extended styles
  34. #define SPLIT_PROPORTIONAL 0x00000001
  35. #define SPLIT_NONINTERACTIVE 0x00000002
  36. #define SPLIT_RIGHTALIGNED 0x00000004
  37. #define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED
  38. #define SPLIT_GRADIENTBAR 0x00000008
  39. #define SPLIT_FLATBAR 0x00000020
  40. #define SPLIT_FIXEDBARSIZE 0x00000010
  41. // Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are
  42. // mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL.
  43. // Also, SPLIT_FLATBAR overrides SPLIT_GRADIENTBAR if both are set.
  44. template <class T>
  45. class CSplitterImpl
  46. {
  47. public:
  48. enum { m_nPanesCount = 2, m_nPropMax = INT_MAX, m_cxyStep = 10 };
  49. bool m_bVertical;
  50. HWND m_hWndPane[m_nPanesCount];
  51. RECT m_rcSplitter;
  52. int m_xySplitterPos; // splitter bar position
  53. int m_xySplitterPosNew; // internal - new position while moving
  54. HWND m_hWndFocusSave;
  55. int m_nDefActivePane;
  56. int m_cxySplitBar; // splitter bar width/height
  57. HCURSOR m_hCursor;
  58. int m_cxyMin; // minimum pane size
  59. int m_cxyBarEdge; // splitter bar edge
  60. bool m_bFullDrag;
  61. int m_cxyDragOffset; // internal
  62. int m_nProportionalPos;
  63. bool m_bUpdateProportionalPos;
  64. DWORD m_dwExtendedStyle; // splitter specific extended styles
  65. int m_nSinglePane; // single pane mode
  66. int m_xySplitterDefPos; // default position
  67. bool m_bProportionalDefPos; // porportinal def pos
  68. // Constructor
  69. CSplitterImpl(bool bVertical = true) :
  70. m_bVertical(bVertical), m_xySplitterPos(-1), m_xySplitterPosNew(-1), m_hWndFocusSave(NULL),
  71. m_nDefActivePane(SPLIT_PANE_NONE), m_cxySplitBar(4), m_hCursor(NULL), m_cxyMin(0), m_cxyBarEdge(0),
  72. m_bFullDrag(true), m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true),
  73. m_dwExtendedStyle(SPLIT_PROPORTIONAL), m_nSinglePane(SPLIT_PANE_NONE),
  74. m_xySplitterDefPos(-1), m_bProportionalDefPos(false)
  75. {
  76. m_hWndPane[SPLIT_PANE_LEFT] = NULL;
  77. m_hWndPane[SPLIT_PANE_RIGHT] = NULL;
  78. ::SetRectEmpty(&m_rcSplitter);
  79. }
  80. // Attributes
  81. void SetSplitterRect(LPRECT lpRect = NULL, bool bUpdate = true)
  82. {
  83. if(lpRect == NULL)
  84. {
  85. T* pT = static_cast<T*>(this);
  86. pT->GetClientRect(&m_rcSplitter);
  87. }
  88. else
  89. {
  90. m_rcSplitter = *lpRect;
  91. }
  92. if(IsProportional())
  93. UpdateProportionalPos();
  94. else if(IsRightAligned())
  95. UpdateRightAlignPos();
  96. if(bUpdate)
  97. UpdateSplitterLayout();
  98. }
  99. void GetSplitterRect(LPRECT lpRect) const
  100. {
  101. ATLASSERT(lpRect != NULL);
  102. *lpRect = m_rcSplitter;
  103. }
  104. bool SetSplitterPos(int xyPos = -1, bool bUpdate = true)
  105. {
  106. if(xyPos == -1) // -1 == default position
  107. {
  108. if(m_bProportionalDefPos)
  109. {
  110. ATLASSERT((m_xySplitterDefPos >= 0) && (m_xySplitterDefPos <= m_nPropMax));
  111. if(m_bVertical)
  112. xyPos = ::MulDiv(m_xySplitterDefPos, m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge, m_nPropMax);
  113. else
  114. xyPos = ::MulDiv(m_xySplitterDefPos, m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge, m_nPropMax);
  115. }
  116. else if(m_xySplitterDefPos != -1)
  117. {
  118. xyPos = m_xySplitterDefPos;
  119. }
  120. else // not set, use middle position
  121. {
  122. if(m_bVertical)
  123. xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2;
  124. else
  125. xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2;
  126. }
  127. }
  128. // Adjust if out of valid range
  129. int cxyMax = 0;
  130. if(m_bVertical)
  131. cxyMax = m_rcSplitter.right - m_rcSplitter.left;
  132. else
  133. cxyMax = m_rcSplitter.bottom - m_rcSplitter.top;
  134. if(xyPos < m_cxyMin + m_cxyBarEdge)
  135. xyPos = m_cxyMin;
  136. else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin))
  137. xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin;
  138. // Set new position and update if requested
  139. bool bRet = (m_xySplitterPos != xyPos);
  140. m_xySplitterPos = xyPos;
  141. if(m_bUpdateProportionalPos)
  142. {
  143. if(IsProportional())
  144. StoreProportionalPos();
  145. else if(IsRightAligned())
  146. StoreRightAlignPos();
  147. }
  148. else
  149. {
  150. m_bUpdateProportionalPos = true;
  151. }
  152. if(bUpdate && bRet)
  153. UpdateSplitterLayout();
  154. return bRet;
  155. }
  156. int GetSplitterPos() const
  157. {
  158. return m_xySplitterPos;
  159. }
  160. void SetSplitterPosPct(int nPct, bool bUpdate = true)
  161. {
  162. ATLASSERT((nPct >= 0) && (nPct <= 100));
  163. m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100);
  164. UpdateProportionalPos();
  165. if(bUpdate)
  166. UpdateSplitterLayout();
  167. }
  168. int GetSplitterPosPct() const
  169. {
  170. int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
  171. return ((cxyTotal > 0) && (m_xySplitterPos >= 0)) ? ::MulDiv(m_xySplitterPos, 100, cxyTotal) : -1;
  172. }
  173. bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE)
  174. {
  175. ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT) || (nPane == SPLIT_PANE_NONE));
  176. if(!((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT) || (nPane == SPLIT_PANE_NONE)))
  177. return false;
  178. if(nPane != SPLIT_PANE_NONE)
  179. {
  180. if(::IsWindowVisible(m_hWndPane[nPane]) == FALSE)
  181. ::ShowWindow(m_hWndPane[nPane], SW_SHOW);
  182. int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
  183. ::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE);
  184. if(m_nDefActivePane != nPane)
  185. m_nDefActivePane = nPane;
  186. }
  187. else if(m_nSinglePane != SPLIT_PANE_NONE)
  188. {
  189. int nOtherPane = (m_nSinglePane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
  190. ::ShowWindow(m_hWndPane[nOtherPane], SW_SHOW);
  191. }
  192. m_nSinglePane = nPane;
  193. UpdateSplitterLayout();
  194. return true;
  195. }
  196. int GetSinglePaneMode() const
  197. {
  198. return m_nSinglePane;
  199. }
  200. DWORD GetSplitterExtendedStyle() const
  201. {
  202. return m_dwExtendedStyle;
  203. }
  204. DWORD SetSplitterExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0)
  205. {
  206. DWORD dwPrevStyle = m_dwExtendedStyle;
  207. if(dwMask == 0)
  208. m_dwExtendedStyle = dwExtendedStyle;
  209. else
  210. m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
  211. #ifdef _DEBUG
  212. if(IsProportional() && IsRightAligned())
  213. ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n"));
  214. #endif // _DEBUG
  215. return dwPrevStyle;
  216. }
  217. void SetSplitterDefaultPos(int xyPos = -1)
  218. {
  219. m_xySplitterDefPos = xyPos;
  220. m_bProportionalDefPos = false;
  221. }
  222. void SetSplitterDefaultPosPct(int nPct)
  223. {
  224. ATLASSERT((nPct >= 0) && (nPct <= 100));
  225. m_xySplitterDefPos = ::MulDiv(nPct, m_nPropMax, 100);
  226. m_bProportionalDefPos = true;
  227. }
  228. // Splitter operations
  229. void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true)
  230. {
  231. m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop;
  232. m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom;
  233. ATLASSERT((m_hWndPane[SPLIT_PANE_LEFT] == NULL) || (m_hWndPane[SPLIT_PANE_RIGHT] == NULL) || (m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]));
  234. if(bUpdate)
  235. UpdateSplitterLayout();
  236. }
  237. bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true)
  238. {
  239. ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
  240. if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT))
  241. return false;
  242. m_hWndPane[nPane] = hWnd;
  243. ATLASSERT((m_hWndPane[SPLIT_PANE_LEFT] == NULL) || (m_hWndPane[SPLIT_PANE_RIGHT] == NULL) || (m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]));
  244. if(bUpdate)
  245. UpdateSplitterLayout();
  246. return true;
  247. }
  248. HWND GetSplitterPane(int nPane) const
  249. {
  250. ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
  251. if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT))
  252. return NULL;
  253. return m_hWndPane[nPane];
  254. }
  255. bool SetActivePane(int nPane)
  256. {
  257. ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
  258. if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT))
  259. return false;
  260. if((m_nSinglePane != SPLIT_PANE_NONE) && (nPane != m_nSinglePane))
  261. return false;
  262. ::SetFocus(m_hWndPane[nPane]);
  263. m_nDefActivePane = nPane;
  264. return true;
  265. }
  266. int GetActivePane() const
  267. {
  268. int nRet = SPLIT_PANE_NONE;
  269. HWND hWndFocus = ::GetFocus();
  270. if(hWndFocus != NULL)
  271. {
  272. for(int nPane = 0; nPane < m_nPanesCount; nPane++)
  273. {
  274. if((hWndFocus == m_hWndPane[nPane]) || (::IsChild(m_hWndPane[nPane], hWndFocus) != FALSE))
  275. {
  276. nRet = nPane;
  277. break;
  278. }
  279. }
  280. }
  281. return nRet;
  282. }
  283. bool ActivateNextPane(bool bNext = true)
  284. {
  285. int nPane = m_nSinglePane;
  286. if(nPane == SPLIT_PANE_NONE)
  287. {
  288. switch(GetActivePane())
  289. {
  290. case SPLIT_PANE_LEFT:
  291. nPane = SPLIT_PANE_RIGHT;
  292. break;
  293. case SPLIT_PANE_RIGHT:
  294. nPane = SPLIT_PANE_LEFT;
  295. break;
  296. default:
  297. nPane = bNext ? SPLIT_PANE_LEFT : SPLIT_PANE_RIGHT;
  298. break;
  299. }
  300. }
  301. return SetActivePane(nPane);
  302. }
  303. bool SetDefaultActivePane(int nPane)
  304. {
  305. ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
  306. if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT))
  307. return false;
  308. m_nDefActivePane = nPane;
  309. return true;
  310. }
  311. bool SetDefaultActivePane(HWND hWnd)
  312. {
  313. for(int nPane = 0; nPane < m_nPanesCount; nPane++)
  314. {
  315. if(hWnd == m_hWndPane[nPane])
  316. {
  317. m_nDefActivePane = nPane;
  318. return true;
  319. }
  320. }
  321. return false; // not found
  322. }
  323. int GetDefaultActivePane() const
  324. {
  325. return m_nDefActivePane;
  326. }
  327. void DrawSplitter(CDCHandle dc)
  328. {
  329. ATLASSERT(dc.m_hDC != NULL);
  330. if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1))
  331. return;
  332. T* pT = static_cast<T*>(this);
  333. if(m_nSinglePane == SPLIT_PANE_NONE)
  334. {
  335. pT->DrawSplitterBar(dc);
  336. for(int nPane = 0; nPane < m_nPanesCount; nPane++)
  337. {
  338. if(m_hWndPane[nPane] == NULL)
  339. pT->DrawSplitterPane(dc, nPane);
  340. }
  341. }
  342. else
  343. {
  344. if(m_hWndPane[m_nSinglePane] == NULL)
  345. pT->DrawSplitterPane(dc, m_nSinglePane);
  346. }
  347. }
  348. // call to initiate moving splitter bar with keyboard
  349. void MoveSplitterBar()
  350. {
  351. T* pT = static_cast<T*>(this);
  352. int x = 0;
  353. int y = 0;
  354. if(m_bVertical)
  355. {
  356. x = m_xySplitterPos + (m_cxySplitBar / 2) + m_cxyBarEdge;
  357. y = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2;
  358. }
  359. else
  360. {
  361. x = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2;
  362. y = m_xySplitterPos + (m_cxySplitBar / 2) + m_cxyBarEdge;
  363. }
  364. POINT pt = { x, y };
  365. pT->ClientToScreen(&pt);
  366. ::SetCursorPos(pt.x, pt.y);
  367. m_xySplitterPosNew = m_xySplitterPos;
  368. pT->SetCapture();
  369. m_hWndFocusSave = pT->SetFocus();
  370. ::SetCursor(m_hCursor);
  371. if(!m_bFullDrag)
  372. DrawGhostBar();
  373. if(m_bVertical)
  374. m_cxyDragOffset = x - m_rcSplitter.left - m_xySplitterPos;
  375. else
  376. m_cxyDragOffset = y - m_rcSplitter.top - m_xySplitterPos;
  377. }
  378. void SetOrientation(bool bVertical, bool bUpdate = true)
  379. {
  380. if(m_bVertical != bVertical)
  381. {
  382. m_bVertical = bVertical;
  383. m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE : IDC_SIZENS);
  384. T* pT = static_cast<T*>(this);
  385. pT->GetSystemSettings(false);
  386. if(m_bVertical)
  387. m_xySplitterPos = ::MulDiv(m_xySplitterPos, m_rcSplitter.right - m_rcSplitter.left, m_rcSplitter.bottom - m_rcSplitter.top);
  388. else
  389. m_xySplitterPos = ::MulDiv(m_xySplitterPos, m_rcSplitter.bottom - m_rcSplitter.top, m_rcSplitter.right - m_rcSplitter.left);
  390. }
  391. if(bUpdate)
  392. UpdateSplitterLayout();
  393. }
  394. // Overrideables
  395. void DrawSplitterBar(CDCHandle dc)
  396. {
  397. RECT rect = {};
  398. if(GetSplitterBarRect(&rect))
  399. {
  400. dc.FillRect(&rect, COLOR_3DFACE);
  401. if((m_dwExtendedStyle & SPLIT_FLATBAR) != 0)
  402. {
  403. RECT rect1 = rect;
  404. if(m_bVertical)
  405. rect1.right = rect1.left + 1;
  406. else
  407. rect1.bottom = rect1.top + 1;
  408. dc.FillRect(&rect1, COLOR_WINDOW);
  409. rect1 = rect;
  410. if(m_bVertical)
  411. rect1.left = rect1.right - 1;
  412. else
  413. rect1.top = rect1.bottom - 1;
  414. dc.FillRect(&rect1, COLOR_3DSHADOW);
  415. }
  416. else if((m_dwExtendedStyle & SPLIT_GRADIENTBAR) != 0)
  417. {
  418. RECT rect2 = rect;
  419. if(m_bVertical)
  420. rect2.left = (rect.left + rect.right) / 2 - 1;
  421. else
  422. rect2.top = (rect.top + rect.bottom) / 2 - 1;
  423. dc.GradientFillRect(rect2, ::GetSysColor(COLOR_3DFACE), ::GetSysColor(COLOR_3DSHADOW), m_bVertical);
  424. }
  425. // draw 3D edge if needed
  426. T* pT = static_cast<T*>(this);
  427. if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)
  428. dc.DrawEdge(&rect, EDGE_RAISED, m_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM));
  429. }
  430. }
  431. // called only if pane is empty
  432. void DrawSplitterPane(CDCHandle dc, int nPane)
  433. {
  434. RECT rect = {};
  435. if(GetSplitterPaneRect(nPane, &rect))
  436. {
  437. T* pT = static_cast<T*>(this);
  438. if((pT->GetExStyle() & WS_EX_CLIENTEDGE) == 0)
  439. dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
  440. dc.FillRect(&rect, COLOR_APPWORKSPACE);
  441. }
  442. }
  443. // Message map and handlers
  444. BEGIN_MSG_MAP(CSplitterImpl)
  445. MESSAGE_HANDLER(WM_CREATE, OnCreate)
  446. MESSAGE_HANDLER(WM_PAINT, OnPaint)
  447. MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
  448. if(IsInteractive())
  449. {
  450. MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
  451. MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
  452. MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
  453. MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
  454. MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick)
  455. MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
  456. MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
  457. }
  458. MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
  459. MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
  460. MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
  461. END_MSG_MAP()
  462. LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
  463. {
  464. T* pT = static_cast<T*>(this);
  465. pT->Init();
  466. bHandled = FALSE;
  467. return 1;
  468. }
  469. LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  470. {
  471. T* pT = static_cast<T*>(this);
  472. // try setting position if not set
  473. if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1))
  474. pT->SetSplitterPos();
  475. // do painting
  476. if(wParam != NULL)
  477. {
  478. pT->DrawSplitter((HDC)wParam);
  479. }
  480. else
  481. {
  482. CPaintDC dc(pT->m_hWnd);
  483. pT->DrawSplitter(dc.m_hDC);
  484. }
  485. return 0;
  486. }
  487. LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  488. {
  489. T* pT = static_cast<T*>(this);
  490. if(((HWND)wParam == pT->m_hWnd) && (LOWORD(lParam) == HTCLIENT))
  491. {
  492. DWORD dwPos = ::GetMessagePos();
  493. POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
  494. pT->ScreenToClient(&ptPos);
  495. if(IsOverSplitterBar(ptPos.x, ptPos.y))
  496. return 1;
  497. }
  498. bHandled = FALSE;
  499. return 0;
  500. }
  501. LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
  502. {
  503. T* pT = static_cast<T*>(this);
  504. int xPos = GET_X_LPARAM(lParam);
  505. int yPos = GET_Y_LPARAM(lParam);
  506. if(::GetCapture() == pT->m_hWnd)
  507. {
  508. int xyNewSplitPos = 0;
  509. if(m_bVertical)
  510. xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset;
  511. else
  512. xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset;
  513. if(xyNewSplitPos == -1) // avoid -1, that means default position
  514. xyNewSplitPos = -2;
  515. if(m_xySplitterPos != xyNewSplitPos)
  516. {
  517. if(m_bFullDrag)
  518. {
  519. if(pT->SetSplitterPos(xyNewSplitPos, true))
  520. pT->UpdateWindow();
  521. }
  522. else
  523. {
  524. DrawGhostBar();
  525. pT->SetSplitterPos(xyNewSplitPos, false);
  526. DrawGhostBar();
  527. }
  528. }
  529. }
  530. else // not dragging, just set cursor
  531. {
  532. if(IsOverSplitterBar(xPos, yPos))
  533. ::SetCursor(m_hCursor);
  534. bHandled = FALSE;
  535. }
  536. return 0;
  537. }
  538. LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
  539. {
  540. T* pT = static_cast<T*>(this);
  541. int xPos = GET_X_LPARAM(lParam);
  542. int yPos = GET_Y_LPARAM(lParam);
  543. if((::GetCapture() != pT->m_hWnd) && IsOverSplitterBar(xPos, yPos))
  544. {
  545. m_xySplitterPosNew = m_xySplitterPos;
  546. pT->SetCapture();
  547. m_hWndFocusSave = pT->SetFocus();
  548. ::SetCursor(m_hCursor);
  549. if(!m_bFullDrag)
  550. DrawGhostBar();
  551. if(m_bVertical)
  552. m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos;
  553. else
  554. m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos;
  555. }
  556. else if((::GetCapture() == pT->m_hWnd) && !IsOverSplitterBar(xPos, yPos))
  557. {
  558. ::ReleaseCapture();
  559. }
  560. bHandled = FALSE;
  561. return 1;
  562. }
  563. LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
  564. {
  565. T* pT = static_cast<T*>(this);
  566. if(::GetCapture() == pT->m_hWnd)
  567. {
  568. m_xySplitterPosNew = m_xySplitterPos;
  569. ::ReleaseCapture();
  570. }
  571. bHandled = FALSE;
  572. return 1;
  573. }
  574. LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  575. {
  576. T* pT = static_cast<T*>(this);
  577. pT->SetSplitterPos(); // default
  578. return 0;
  579. }
  580. LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  581. {
  582. if(!m_bFullDrag)
  583. DrawGhostBar();
  584. if((m_xySplitterPosNew != -1) && (!m_bFullDrag || (m_xySplitterPos != m_xySplitterPosNew)))
  585. {
  586. m_xySplitterPos = m_xySplitterPosNew;
  587. m_xySplitterPosNew = -1;
  588. UpdateSplitterLayout();
  589. T* pT = static_cast<T*>(this);
  590. pT->UpdateWindow();
  591. }
  592. if(m_hWndFocusSave != NULL)
  593. ::SetFocus(m_hWndFocusSave);
  594. return 0;
  595. }
  596. LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
  597. {
  598. T* pT = static_cast<T*>(this);
  599. if(::GetCapture() == pT->m_hWnd)
  600. {
  601. switch(wParam)
  602. {
  603. case VK_RETURN:
  604. m_xySplitterPosNew = m_xySplitterPos;
  605. // FALLTHROUGH
  606. case VK_ESCAPE:
  607. ::ReleaseCapture();
  608. break;
  609. case VK_LEFT:
  610. case VK_RIGHT:
  611. if(m_bVertical)
  612. {
  613. POINT pt = {};
  614. ::GetCursorPos(&pt);
  615. int xyPos = m_xySplitterPos + ((wParam == VK_LEFT) ? -pT->m_cxyStep : pT->m_cxyStep);
  616. int cxyMax = m_rcSplitter.right - m_rcSplitter.left;
  617. if(xyPos < (m_cxyMin + m_cxyBarEdge))
  618. xyPos = m_cxyMin;
  619. else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin))
  620. xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin;
  621. pt.x += xyPos - m_xySplitterPos;
  622. ::SetCursorPos(pt.x, pt.y);
  623. }
  624. break;
  625. case VK_UP:
  626. case VK_DOWN:
  627. if(!m_bVertical)
  628. {
  629. POINT pt = {};
  630. ::GetCursorPos(&pt);
  631. int xyPos = m_xySplitterPos + ((wParam == VK_UP) ? -pT->m_cxyStep : pT->m_cxyStep);
  632. int cxyMax = m_rcSplitter.bottom - m_rcSplitter.top;
  633. if(xyPos < (m_cxyMin + m_cxyBarEdge))
  634. xyPos = m_cxyMin;
  635. else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin))
  636. xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin;
  637. pt.y += xyPos - m_xySplitterPos;
  638. ::SetCursorPos(pt.x, pt.y);
  639. }
  640. break;
  641. default:
  642. break;
  643. }
  644. }
  645. else
  646. {
  647. bHandled = FALSE;
  648. }
  649. return 0;
  650. }
  651. LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled)
  652. {
  653. T* pT = static_cast<T*>(this);
  654. if(::GetCapture() != pT->m_hWnd)
  655. {
  656. if(m_nSinglePane == SPLIT_PANE_NONE)
  657. {
  658. if((m_nDefActivePane == SPLIT_PANE_LEFT) || (m_nDefActivePane == SPLIT_PANE_RIGHT))
  659. ::SetFocus(m_hWndPane[m_nDefActivePane]);
  660. }
  661. else
  662. {
  663. ::SetFocus(m_hWndPane[m_nSinglePane]);
  664. }
  665. }
  666. bHandled = FALSE;
  667. return 1;
  668. }
  669. LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
  670. {
  671. T* pT = static_cast<T*>(this);
  672. LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam);
  673. if((lRet == MA_ACTIVATE) || (lRet == MA_ACTIVATEANDEAT))
  674. {
  675. DWORD dwPos = ::GetMessagePos();
  676. POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
  677. pT->ScreenToClient(&pt);
  678. RECT rcPane = {};
  679. for(int nPane = 0; nPane < m_nPanesCount; nPane++)
  680. {
  681. if(GetSplitterPaneRect(nPane, &rcPane) && (::PtInRect(&rcPane, pt) != FALSE))
  682. {
  683. m_nDefActivePane = nPane;
  684. break;
  685. }
  686. }
  687. }
  688. return lRet;
  689. }
  690. LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  691. {
  692. T* pT = static_cast<T*>(this);
  693. pT->GetSystemSettings(true);
  694. return 0;
  695. }
  696. // Implementation - internal helpers
  697. void Init()
  698. {
  699. m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE : IDC_SIZENS);
  700. T* pT = static_cast<T*>(this);
  701. pT->GetSystemSettings(false);
  702. }
  703. void UpdateSplitterLayout()
  704. {
  705. if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1))
  706. return;
  707. T* pT = static_cast<T*>(this);
  708. RECT rect = {};
  709. if(m_nSinglePane == SPLIT_PANE_NONE)
  710. {
  711. if(GetSplitterBarRect(&rect))
  712. pT->InvalidateRect(&rect);
  713. for(int nPane = 0; nPane < m_nPanesCount; nPane++)
  714. {
  715. if(GetSplitterPaneRect(nPane, &rect))
  716. {
  717. if(m_hWndPane[nPane] != NULL)
  718. ::SetWindowPos(m_hWndPane[nPane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
  719. else
  720. pT->InvalidateRect(&rect);
  721. }
  722. }
  723. }
  724. else
  725. {
  726. if(GetSplitterPaneRect(m_nSinglePane, &rect))
  727. {
  728. if(m_hWndPane[m_nSinglePane] != NULL)
  729. ::SetWindowPos(m_hWndPane[m_nSinglePane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
  730. else
  731. pT->InvalidateRect(&rect);
  732. }
  733. }
  734. }
  735. bool GetSplitterBarRect(LPRECT lpRect) const
  736. {
  737. ATLASSERT(lpRect != NULL);
  738. if((m_nSinglePane != SPLIT_PANE_NONE) || (m_xySplitterPos == -1))
  739. return false;
  740. if(m_bVertical)
  741. {
  742. lpRect->left = m_rcSplitter.left + m_xySplitterPos;
  743. lpRect->top = m_rcSplitter.top;
  744. lpRect->right = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
  745. lpRect->bottom = m_rcSplitter.bottom;
  746. }
  747. else
  748. {
  749. lpRect->left = m_rcSplitter.left;
  750. lpRect->top = m_rcSplitter.top + m_xySplitterPos;
  751. lpRect->right = m_rcSplitter.right;
  752. lpRect->bottom = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
  753. }
  754. return true;
  755. }
  756. bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const
  757. {
  758. ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
  759. ATLASSERT(lpRect != NULL);
  760. bool bRet = true;
  761. if(m_nSinglePane != SPLIT_PANE_NONE)
  762. {
  763. if(nPane == m_nSinglePane)
  764. *lpRect = m_rcSplitter;
  765. else
  766. bRet = false;
  767. }
  768. else if(nPane == SPLIT_PANE_LEFT)
  769. {
  770. if(m_bVertical)
  771. {
  772. lpRect->left = m_rcSplitter.left;
  773. lpRect->top = m_rcSplitter.top;
  774. lpRect->right = m_rcSplitter.left + m_xySplitterPos;
  775. lpRect->bottom = m_rcSplitter.bottom;
  776. }
  777. else
  778. {
  779. lpRect->left = m_rcSplitter.left;
  780. lpRect->top = m_rcSplitter.top;
  781. lpRect->right = m_rcSplitter.right;
  782. lpRect->bottom = m_rcSplitter.top + m_xySplitterPos;
  783. }
  784. }
  785. else if(nPane == SPLIT_PANE_RIGHT)
  786. {
  787. if(m_bVertical)
  788. {
  789. lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
  790. lpRect->top = m_rcSplitter.top;
  791. lpRect->right = m_rcSplitter.right;
  792. lpRect->bottom = m_rcSplitter.bottom;
  793. }
  794. else
  795. {
  796. lpRect->left = m_rcSplitter.left;
  797. lpRect->top = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
  798. lpRect->right = m_rcSplitter.right;
  799. lpRect->bottom = m_rcSplitter.bottom;
  800. }
  801. }
  802. else
  803. {
  804. bRet = false;
  805. }
  806. return bRet;
  807. }
  808. bool IsOverSplitterRect(int x, int y) const
  809. {
  810. // -1 == don't check
  811. return (((x == -1) || ((x >= m_rcSplitter.left) && (x <= m_rcSplitter.right))) &&
  812. ((y == -1) || ((y >= m_rcSplitter.top) && (y <= m_rcSplitter.bottom))));
  813. }
  814. bool IsOverSplitterBar(int x, int y) const
  815. {
  816. if(m_nSinglePane != SPLIT_PANE_NONE)
  817. return false;
  818. if((m_xySplitterPos == -1) || !IsOverSplitterRect(x, y))
  819. return false;
  820. int xy = m_bVertical ? x : y;
  821. int xyOff = m_bVertical ? m_rcSplitter.left : m_rcSplitter.top;
  822. return ((xy >= (xyOff + m_xySplitterPos)) && (xy < (xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge)));
  823. }
  824. void DrawGhostBar()
  825. {
  826. RECT rect = {};
  827. if(GetSplitterBarRect(&rect))
  828. {
  829. // convert client to window coordinates
  830. T* pT = static_cast<T*>(this);
  831. RECT rcWnd = {};
  832. pT->GetWindowRect(&rcWnd);
  833. ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcWnd, 2);
  834. ::OffsetRect(&rect, -rcWnd.left, -rcWnd.top);
  835. // invert the brush pattern (looks just like frame window sizing)
  836. CBrush brush(CDCHandle::GetHalftoneBrush());
  837. if(brush.m_hBrush != NULL)
  838. {
  839. CWindowDC dc(pT->m_hWnd);
  840. CBrushHandle brushOld = dc.SelectBrush(brush);
  841. dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT);
  842. dc.SelectBrush(brushOld);
  843. }
  844. }
  845. }
  846. void GetSystemSettings(bool bUpdate)
  847. {
  848. if((m_dwExtendedStyle & SPLIT_FIXEDBARSIZE) == 0)
  849. {
  850. m_cxySplitBar = ::GetSystemMetrics(m_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME);
  851. }
  852. T* pT = static_cast<T*>(this);
  853. if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)
  854. {
  855. m_cxyBarEdge = 2 * ::GetSystemMetrics(m_bVertical ? SM_CXEDGE : SM_CYEDGE);
  856. m_cxyMin = 0;
  857. }
  858. else
  859. {
  860. m_cxyBarEdge = 0;
  861. m_cxyMin = 2 * ::GetSystemMetrics(m_bVertical ? SM_CXEDGE : SM_CYEDGE);
  862. }
  863. ::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0);
  864. if(bUpdate)
  865. UpdateSplitterLayout();
  866. }
  867. bool IsProportional() const
  868. {
  869. return ((m_dwExtendedStyle & SPLIT_PROPORTIONAL) != 0);
  870. }
  871. void StoreProportionalPos()
  872. {
  873. int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
  874. if(cxyTotal > 0)
  875. m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal);
  876. else
  877. m_nProportionalPos = 0;
  878. ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreProportionalPos - %i\n"), m_nProportionalPos);
  879. }
  880. void UpdateProportionalPos()
  881. {
  882. int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
  883. if(cxyTotal > 0)
  884. {
  885. int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax);
  886. m_bUpdateProportionalPos = false;
  887. T* pT = static_cast<T*>(this);
  888. pT->SetSplitterPos(xyNewPos, false);
  889. }
  890. }
  891. bool IsRightAligned() const
  892. {
  893. return ((m_dwExtendedStyle & SPLIT_RIGHTALIGNED) != 0);
  894. }
  895. void StoreRightAlignPos()
  896. {
  897. int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
  898. if(cxyTotal > 0)
  899. m_nProportionalPos = cxyTotal - m_xySplitterPos;
  900. else
  901. m_nProportionalPos = 0;
  902. ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreRightAlignPos - %i\n"), m_nProportionalPos);
  903. }
  904. void UpdateRightAlignPos()
  905. {
  906. int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
  907. if(cxyTotal > 0)
  908. {
  909. m_bUpdateProportionalPos = false;
  910. T* pT = static_cast<T*>(this);
  911. pT->SetSplitterPos(cxyTotal - m_nProportionalPos, false);
  912. }
  913. }
  914. bool IsInteractive() const
  915. {
  916. return ((m_dwExtendedStyle & SPLIT_NONINTERACTIVE) == 0);
  917. }
  918. };
  919. ///////////////////////////////////////////////////////////////////////////////
  920. // CSplitterWindowImpl - Implements a splitter window
  921. template <class T, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
  922. class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T >
  923. {
  924. public:
  925. DECLARE_WND_CLASS_EX2(NULL, T, CS_DBLCLKS, COLOR_WINDOW)
  926. CSplitterWindowImpl(bool bVertical = true) : CSplitterImpl< T >(bVertical)
  927. { }
  928. BOOL SubclassWindow(HWND hWnd)
  929. {
  930. BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd);
  931. if(bRet != FALSE)
  932. {
  933. T* pT = static_cast<T*>(this);
  934. pT->Init();
  935. this->SetSplitterRect();
  936. }
  937. return bRet;
  938. }
  939. BEGIN_MSG_MAP(CSplitterWindowImpl)
  940. MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
  941. MESSAGE_HANDLER(WM_SIZE, OnSize)
  942. CHAIN_MSG_MAP(CSplitterImpl< T >)
  943. FORWARD_NOTIFICATIONS()
  944. END_MSG_MAP()
  945. LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  946. {
  947. // handled, no background painting needed
  948. return 1;
  949. }
  950. LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
  951. {
  952. if(wParam != SIZE_MINIMIZED)
  953. this->SetSplitterRect();
  954. bHandled = FALSE;
  955. return 1;
  956. }
  957. };
  958. ///////////////////////////////////////////////////////////////////////////////
  959. // CSplitterWindow/CHorSplitterWindow - Implements splitter windows to be used as is
  960. template <bool t_bVertical = true>
  961. class CSplitterWindowT : public CSplitterWindowImpl<CSplitterWindowT<t_bVertical> >
  962. {
  963. public:
  964. DECLARE_WND_CLASS_EX2(_T("WTL_SplitterWindow"), CSplitterWindowT<t_bVertical>, CS_DBLCLKS, COLOR_WINDOW)
  965. CSplitterWindowT() : CSplitterWindowImpl<CSplitterWindowT<t_bVertical> >(t_bVertical)
  966. { }
  967. };
  968. typedef CSplitterWindowT<true> CSplitterWindow;
  969. typedef CSplitterWindowT<false> CHorSplitterWindow;
  970. } // namespace WTL
  971. #endif // __ATLSPLIT_H__