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.

188 lines
3.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: ccinline.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _INC_CSCVIEW_CCINLINE_H
  11. #define _INC_CSCVIEW_CCINLINE_H
  12. ///////////////////////////////////////////////////////////////////////////////
  13. /* File: ccinline.h
  14. Description: Inline functions for sending messages to windows controls.
  15. Provides functionality similar to the macros defined in windowsx.h
  16. for those messages that don't have macros in windowsx.h.
  17. Revision History:
  18. Date Description Programmer
  19. -------- --------------------------------------------------- ----------
  20. 10/16/97 Initial creation. BrianAu
  21. */
  22. ///////////////////////////////////////////////////////////////////////////////
  23. #ifndef _INC_COMMCTRL
  24. # include "commctrl.h"
  25. #endif
  26. inline bool
  27. StatusBar_SetText(
  28. HWND hCtl,
  29. int iPart,
  30. UINT uType,
  31. LPCTSTR psz
  32. )
  33. {
  34. return boolify(SendMessage(hCtl, SB_SETTEXT, MAKEWPARAM(iPart, uType), (LPARAM)psz));
  35. }
  36. inline bool
  37. StatusBar_SetParts(
  38. HWND hCtl,
  39. int cParts,
  40. int *prgWidths
  41. )
  42. {
  43. return boolify(SendMessage(hCtl, SB_SETPARTS, (WPARAM)cParts, (LPARAM)prgWidths));
  44. }
  45. inline bool
  46. StatusBar_GetRect(
  47. HWND hCtl,
  48. int iPart,
  49. RECT *prc
  50. )
  51. {
  52. return boolify(SendMessage(hCtl, SB_GETRECT, (WPARAM)iPart, (LPARAM)prc));
  53. }
  54. inline void
  55. ToolBar_AutoSize(
  56. HWND hCtl
  57. )
  58. {
  59. SendMessage(hCtl, TB_AUTOSIZE, 0, 0);
  60. }
  61. inline bool
  62. ToolBar_GetItemRect(
  63. HWND hCtl,
  64. int iItem,
  65. RECT *prcItem
  66. )
  67. {
  68. return boolify(SendMessage(hCtl, TB_GETITEMRECT, iItem, (LPARAM)prcItem));
  69. }
  70. inline bool
  71. ToolBar_DeleteButton(
  72. HWND hCtl,
  73. int iBtn
  74. )
  75. {
  76. return boolify(SendMessage(hCtl, TB_DELETEBUTTON, (WPARAM)iBtn, 0));
  77. }
  78. inline int
  79. ProgressBar_SetPos(
  80. HWND hCtl,
  81. int iPos
  82. )
  83. {
  84. return (int)SendMessage(hCtl, PBM_SETPOS, (WPARAM)iPos, 0);
  85. }
  86. inline DWORD
  87. ProgressBar_SetRange(
  88. HWND hCtl,
  89. short iMin,
  90. short iMax
  91. )
  92. {
  93. return (DWORD)SendMessage(hCtl, PBM_SETRANGE, 0, MAKELPARAM(iMin, iMax));
  94. }
  95. inline int
  96. ProgressBar_SetStep(
  97. HWND hCtl,
  98. int iStep
  99. )
  100. {
  101. return (int)SendMessage(hCtl, PBM_SETSTEP, (WPARAM)iStep, 0);
  102. }
  103. inline void
  104. ProgressBar_StepIt(
  105. HWND hCtl
  106. )
  107. {
  108. SendMessage(hCtl, PBM_STEPIT, 0, 0);
  109. }
  110. inline int
  111. ProgressBar_GetRange(
  112. HWND hCtl,
  113. bool fWhichLimit,
  114. PBRANGE *pRange
  115. )
  116. {
  117. return (int)SendMessage(hCtl, PBM_GETRANGE, (WPARAM)fWhichLimit, (LPARAM)pRange);
  118. }
  119. inline void
  120. TrackBar_SetPos(
  121. HWND hCtl,
  122. int iPos,
  123. bool bRedraw
  124. )
  125. {
  126. SendMessage(hCtl, TBM_SETPOS, (WPARAM)bRedraw, (LPARAM)iPos);
  127. }
  128. inline int
  129. TrackBar_GetPos(
  130. HWND hCtl
  131. )
  132. {
  133. return (int)SendMessage(hCtl, TBM_GETPOS, 0, 0);
  134. }
  135. inline void
  136. TrackBar_SetRange(
  137. HWND hCtl,
  138. int iMin,
  139. int iMax,
  140. bool bRedraw
  141. )
  142. {
  143. SendMessage(hCtl, TBM_SETRANGEMIN, (WPARAM)FALSE, (LPARAM)iMin);
  144. SendMessage(hCtl, TBM_SETRANGEMAX, (WPARAM)bRedraw, (LPARAM)iMax);
  145. }
  146. inline void
  147. TrackBar_SetTicFreq(
  148. HWND hCtl,
  149. int iFreq
  150. )
  151. {
  152. SendMessage(hCtl, TBM_SETTICFREQ, (WPARAM)iFreq, 0);
  153. }
  154. inline void
  155. TrackBar_SetPageSize(
  156. HWND hCtl,
  157. int iPageSize
  158. )
  159. {
  160. SendMessage(hCtl, TBM_SETPAGESIZE, 0, (LPARAM)iPageSize);
  161. }
  162. #endif //_INC_CSCVIEW_CCINLINE_H