Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

368 lines
8.7 KiB

  1. /*--------------------------------------------------------------------------*
  2. *
  3. * Microsoft Windows
  4. * Copyright (C) Microsoft Corporation, 1992 - 00
  5. *
  6. * File: controls.inl
  7. *
  8. * Contents: Inline functions for controls.h
  9. *
  10. * History: 7-Jul-2000 jeffro Created
  11. *
  12. *--------------------------------------------------------------------------*/
  13. #pragma once
  14. /*+-------------------------------------------------------------------------*
  15. * CToolBarCtrlBase inline functions
  16. *
  17. *
  18. *--------------------------------------------------------------------------*/
  19. inline CImageList* CToolBarCtrlBase::GetImageList_(int msg)
  20. {
  21. return (CImageList::FromHandle ((HIMAGELIST) SendMessage (msg)));
  22. }
  23. // Toolbar with multiple imagelists.
  24. inline CImageList* CToolBarCtrlBase::SetImageList_(int msg, CImageList* pImageList, int idImageList)
  25. {
  26. return (CImageList::FromHandle ((HIMAGELIST) SendMessage (msg, idImageList, (LPARAM)pImageList->GetSafeHandle())));
  27. }
  28. inline CImageList* CToolBarCtrlBase::GetImageList()
  29. {
  30. return (GetImageList_(TB_GETIMAGELIST));
  31. }
  32. // Toolbar with multiple imagelists.
  33. inline CImageList* CToolBarCtrlBase::SetImageList(CImageList* pImageList, int idImageList)
  34. {
  35. return (SetImageList_(TB_SETIMAGELIST, pImageList, idImageList));
  36. }
  37. inline CImageList* CToolBarCtrlBase::GetHotImageList()
  38. {
  39. return (GetImageList_(TB_GETHOTIMAGELIST));
  40. }
  41. inline CImageList* CToolBarCtrlBase::SetHotImageList(CImageList* pImageList)
  42. {
  43. return (SetImageList_(TB_SETHOTIMAGELIST, pImageList));
  44. }
  45. inline CImageList* CToolBarCtrlBase::GetDisabledImageList()
  46. {
  47. return (GetImageList_(TB_GETDISABLEDIMAGELIST));
  48. }
  49. inline CImageList* CToolBarCtrlBase::SetDisabledImageList(CImageList* pImageList)
  50. {
  51. return (SetImageList_(TB_SETDISABLEDIMAGELIST, pImageList));
  52. }
  53. inline void CToolBarCtrlBase::SetMaxTextRows(int iMaxRows)
  54. {
  55. SendMessage (TB_SETMAXTEXTROWS, iMaxRows);
  56. }
  57. inline void CToolBarCtrlBase::SetButtonWidth(int cxMin, int cxMax)
  58. {
  59. SendMessage (TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax));
  60. }
  61. inline DWORD CToolBarCtrlBase::GetButtonSize(void)
  62. {
  63. return SendMessage (TB_GETBUTTONSIZE);
  64. }
  65. inline CWnd* CToolBarCtrlBase::SetOwner(CWnd* pwndNewParent)
  66. {
  67. return (CWnd::FromHandle ((HWND) SendMessage (TB_SETPARENT, (WPARAM) pwndNewParent->GetSafeHwnd())));
  68. }
  69. #if (_WIN32_IE >= 0x0400)
  70. inline int CToolBarCtrlBase::GetHotItem ()
  71. {
  72. return (SendMessage (TB_GETHOTITEM));
  73. }
  74. inline int CToolBarCtrlBase::SetHotItem (int iHot)
  75. {
  76. return (SendMessage (TB_SETHOTITEM, iHot));
  77. }
  78. inline CSize CToolBarCtrlBase::GetPadding ()
  79. {
  80. return (CSize (SendMessage (TB_GETPADDING)));
  81. }
  82. inline CSize CToolBarCtrlBase::SetPadding (CSize size)
  83. {
  84. return (CSize (SendMessage (TB_SETPADDING, 0, MAKELPARAM (size.cx, size.cy))));
  85. }
  86. inline bool CToolBarCtrlBase::GetButtonInfo (int iID, LPTBBUTTONINFO ptbbi)
  87. {
  88. return (SendMessage (TB_GETBUTTONINFO, iID, (LPARAM) ptbbi) != 0);
  89. }
  90. inline bool CToolBarCtrlBase::SetButtonInfo (int iID, LPTBBUTTONINFO ptbbi)
  91. {
  92. return (SendMessage (TB_SETBUTTONINFO, iID, (LPARAM) ptbbi) != 0);
  93. }
  94. #endif // _WIN32_IE >= 0x0400
  95. /*+-------------------------------------------------------------------------*
  96. * CToolBarCtrlEx inline functions
  97. *
  98. *
  99. *--------------------------------------------------------------------------*/
  100. inline BOOL CToolBarCtrlEx::SetBitmapSize(CSize sz)
  101. {
  102. if (!BaseClass::SetBitmapSize(sz))
  103. return (FALSE);
  104. m_sizeBitmap = sz;
  105. return (TRUE);
  106. }
  107. inline CSize CToolBarCtrlEx::GetBitmapSize(void)
  108. {
  109. return m_sizeBitmap;
  110. }
  111. /*+-------------------------------------------------------------------------*
  112. * CTabCtrlEx inline functions
  113. *
  114. *
  115. *--------------------------------------------------------------------------*/
  116. inline void CTabCtrlEx::DeselectAll (bool fExcludeFocus)
  117. {
  118. SendMessage (TCM_DESELECTALL, fExcludeFocus);
  119. }
  120. inline bool CTabCtrlEx::HighlightItem (UINT nItem, bool fHighlight)
  121. {
  122. return (SendMessage (TCM_HIGHLIGHTITEM, nItem, MAKELONG (fHighlight, 0)) ? true : false);
  123. }
  124. inline DWORD CTabCtrlEx::GetExtendedStyle ()
  125. {
  126. return (SendMessage (TCM_GETEXTENDEDSTYLE));
  127. }
  128. inline DWORD CTabCtrlEx::SetExtendedStyle (DWORD dwExStyle, DWORD dwMask /* =0 */)
  129. {
  130. return (SendMessage (TCM_SETEXTENDEDSTYLE, dwMask, dwExStyle));
  131. }
  132. inline bool CTabCtrlEx::GetUnicodeFormat ()
  133. {
  134. return (SendMessage (TCM_GETUNICODEFORMAT) ? true : false);
  135. }
  136. inline bool CTabCtrlEx::SetUnicodeFormat (bool fUnicode)
  137. {
  138. return (SendMessage (TCM_SETUNICODEFORMAT, fUnicode) ? true : false);
  139. }
  140. inline void CTabCtrlEx::SetCurFocus (UINT nItem)
  141. {
  142. SendMessage (TCM_SETCURFOCUS, nItem);
  143. }
  144. inline bool CTabCtrlEx::SetItemExtra (UINT cbExtra)
  145. {
  146. return (SendMessage (TCM_SETITEMEXTRA, cbExtra) ? true : false);
  147. }
  148. inline int CTabCtrlEx::SetMinTabWidth (int cx)
  149. {
  150. return (SendMessage (TCM_SETMINTABWIDTH, 0, cx));
  151. }
  152. /*+-------------------------------------------------------------------------*
  153. * CRebarWnd inline functions
  154. *
  155. *
  156. *--------------------------------------------------------------------------*/
  157. inline LRESULT CRebarWnd::SetBarInfo(REBARINFO* prbi)
  158. {
  159. ASSERT (prbi != NULL);
  160. return SendMessage (RB_SETBARINFO, 0, (LPARAM)prbi);
  161. }
  162. inline LRESULT CRebarWnd::GetBarInfo(REBARINFO* prbi)
  163. {
  164. ASSERT (prbi != NULL);
  165. return SendMessage (RB_GETBARINFO, 0, (LPARAM)prbi);
  166. }
  167. inline LRESULT CRebarWnd::InsertBand(LPREBARBANDINFO lprbbi)
  168. {
  169. ASSERT(lprbbi!=NULL);
  170. return SendMessage (RB_INSERTBAND, -1, (LPARAM)lprbbi);
  171. }
  172. inline LRESULT CRebarWnd::SetBandInfo(UINT uBand, LPREBARBANDINFO lprbbi)
  173. {
  174. ASSERT(lprbbi!=NULL);
  175. return SendMessage (RB_SETBANDINFO, uBand, (LPARAM)lprbbi);
  176. }
  177. inline LRESULT CRebarWnd::GetBandInfo(UINT uBand, LPREBARBANDINFO lprbbi)
  178. {
  179. ASSERT(lprbbi!=NULL);
  180. return SendMessage (RB_GETBANDINFO, uBand, (LPARAM)lprbbi);
  181. }
  182. inline LRESULT CRebarWnd::DeleteBand(UINT uBand)
  183. {
  184. return SendMessage (RB_DELETEBAND, uBand);
  185. }
  186. inline CWnd* CRebarWnd::SetParent(CWnd* pwndParent)
  187. {
  188. return CWnd::FromHandle((HWND)SendMessage (RB_SETPARENT, (WPARAM) pwndParent->GetSafeHwnd()));
  189. }
  190. inline UINT CRebarWnd::GetBandCount()
  191. {
  192. return SendMessage (RB_GETBANDCOUNT);
  193. }
  194. inline UINT CRebarWnd::GetRowCount()
  195. {
  196. return SendMessage (RB_GETROWCOUNT);
  197. }
  198. inline UINT CRebarWnd::GetRowHeight(UINT uRow)
  199. {
  200. return SendMessage (RB_GETROWHEIGHT);
  201. }
  202. #if (_WIN32_IE >= 0x0400)
  203. inline int CRebarWnd::HitTest (LPRBHITTESTINFO lprbht)
  204. {
  205. ASSERT (lprbht != NULL);
  206. return SendMessage (RB_HITTEST, 0, (LPARAM) lprbht);
  207. }
  208. inline BOOL CRebarWnd::GetRect (UINT uBand, LPRECT lprc)
  209. {
  210. ASSERT (lprc != NULL);
  211. return SendMessage (RB_GETRECT, uBand, (LPARAM) lprc);
  212. }
  213. inline int CRebarWnd::IdToIndex (UINT uBandID)
  214. {
  215. return SendMessage (RB_IDTOINDEX, uBandID);
  216. }
  217. inline CWnd* CRebarWnd::GetToolTips ()
  218. {
  219. return CWnd::FromHandle ((HWND)SendMessage (RB_GETTOOLTIPS));
  220. }
  221. inline void CRebarWnd::SetToolTips (CWnd* pwndTips)
  222. {
  223. SendMessage (RB_SETTOOLTIPS, (WPARAM) pwndTips->GetSafeHwnd());
  224. }
  225. inline COLORREF CRebarWnd::GetBkColor ()
  226. {
  227. return SendMessage (RB_GETBKCOLOR);
  228. }
  229. inline COLORREF CRebarWnd::SetBkColor (COLORREF clrBk)
  230. {
  231. return SendMessage (RB_SETBKCOLOR, 0, clrBk);
  232. }
  233. inline COLORREF CRebarWnd::GetTextColor ()
  234. {
  235. return SendMessage (RB_GETTEXTCOLOR);
  236. }
  237. inline COLORREF CRebarWnd::SetTextColor (COLORREF clrText)
  238. {
  239. return SendMessage (RB_SETTEXTCOLOR, 0, clrText);
  240. }
  241. inline LRESULT CRebarWnd::SizeToRect (LPRECT lprc)
  242. {
  243. ASSERT (lprc != NULL);
  244. return SendMessage (RB_SIZETORECT, 0, (LPARAM) lprc);
  245. }
  246. inline void CRebarWnd::BeginDrag (UINT uBand, CPoint point)
  247. {
  248. BeginDrag (uBand, MAKELONG (point.x, point.y));
  249. }
  250. inline void CRebarWnd::BeginDrag (UINT uBand, DWORD dwPos)
  251. {
  252. SendMessage (RB_BEGINDRAG, uBand, dwPos);
  253. }
  254. inline void CRebarWnd::EndDrag ()
  255. {
  256. SendMessage (RB_ENDDRAG);
  257. }
  258. inline void CRebarWnd::DragMove (CPoint point)
  259. {
  260. DragMove (MAKELONG (point.x, point.y));
  261. }
  262. inline void CRebarWnd::DragMove (DWORD dwPos)
  263. {
  264. SendMessage (RB_BEGINDRAG, 0, dwPos);
  265. }
  266. inline UINT CRebarWnd::GetBarHeight()
  267. {
  268. return SendMessage (RB_GETBARHEIGHT);
  269. }
  270. inline void CRebarWnd::MinimizeBand(UINT uBand)
  271. {
  272. SendMessage (RB_MINIMIZEBAND, uBand);
  273. }
  274. inline void CRebarWnd::MaximizeBand(UINT uBand, BOOL fIdeal /* =false */)
  275. {
  276. SendMessage (RB_MAXIMIZEBAND, uBand, fIdeal);
  277. }
  278. inline void CRebarWnd::GetBandBorders(UINT uBand, LPRECT lprc)
  279. {
  280. ASSERT (lprc != NULL);
  281. SendMessage (RB_GETBANDBORDERS, uBand, (LPARAM) lprc);
  282. }
  283. inline LRESULT CRebarWnd::ShowBand(UINT uBand, BOOL fShow)
  284. {
  285. return SendMessage (RB_SHOWBAND, uBand, fShow);
  286. }
  287. inline CPalette* CRebarWnd::GetPalette()
  288. {
  289. return CPalette::FromHandle((HPALETTE) SendMessage (RB_GETPALETTE));
  290. }
  291. inline CPalette* CRebarWnd::SetPalette(CPalette * ppal)
  292. {
  293. return CPalette::FromHandle((HPALETTE)SendMessage (RB_SETPALETTE, 0, (LPARAM)ppal->GetSafeHandle()));
  294. }
  295. #endif