Leaked source code of windows server 2003
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.

101 lines
2.6 KiB

  1. /**************************** Module Header ********************************\
  2. * Module Name:
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * Scroll bar public APIs
  7. *
  8. * History:
  9. * 11/21/90 JimA Created.
  10. * 01-31-91 IanJa Revalidaion added
  11. \***************************************************************************/
  12. #include "precomp.h"
  13. #pragma hdrstop
  14. /***************************************************************************\
  15. * xxxShowScrollBar
  16. *
  17. * Shows and hides standard scroll bars or scroll bar controls. If wBar is
  18. * SB_HORZ, SB_VERT, or SB_BOTH, pwnd is assumed to be the handle of the window
  19. * which has the standard scroll bars as styles. If wBar is SB_CTL, pwnd is
  20. * assumed to be the handle of the scroll bar control.
  21. *
  22. * It does not destroy pwnd->rgwScroll like xxxSetScrollBar() does, so that the
  23. * app can hide a standard scroll bar and then show it, without having to reset
  24. * the range and thumbposition.
  25. *
  26. * History:
  27. * 16-May-1991 mikeke Changed to return BOOL
  28. \***************************************************************************/
  29. BOOL xxxShowScrollBar(
  30. PWND pwnd,
  31. UINT wBar, /* SB_HORZ, SB_VERT, SB_BOTH , SB_CTL */
  32. BOOL fShow) /* Show or Hide. */
  33. {
  34. BOOL fChanged = FALSE;
  35. DWORD dwStyle;
  36. CheckLock(pwnd);
  37. switch (wBar)
  38. {
  39. case SB_CTL:
  40. {
  41. xxxShowWindow(
  42. pwnd,
  43. (fShow ? SHOW_OPENWINDOW : HIDE_WINDOW) | TEST_PUDF(PUDF_ANIMATE));
  44. return(TRUE);
  45. }
  46. case SB_HORZ:
  47. dwStyle = WS_HSCROLL;
  48. break;
  49. case SB_VERT:
  50. dwStyle = WS_VSCROLL;
  51. break;
  52. case SB_BOTH:
  53. dwStyle = WS_HSCROLL | WS_VSCROLL;
  54. break;
  55. }
  56. if (!fShow)
  57. {
  58. if (pwnd->style & dwStyle)
  59. {
  60. fChanged = TRUE;
  61. pwnd->style &= ~dwStyle;
  62. }
  63. } else {
  64. if ((pwnd->style & dwStyle) != dwStyle)
  65. {
  66. fChanged = TRUE;
  67. pwnd->style |= dwStyle;
  68. }
  69. /*
  70. * Make sure that pwsb is initialized.
  71. */
  72. if (pwnd->pSBInfo == NULL)
  73. _InitPwSB(pwnd);
  74. }
  75. /*
  76. * If the state changed, redraw the frame and force WM_NCPAINT.
  77. */
  78. if (fChanged) {
  79. /*
  80. * We always redraw even if minimized or hidden... Otherwise, it seems
  81. * the scroll bars aren't properly hidden/shown when we become
  82. * visible
  83. */
  84. xxxRedrawFrame(pwnd);
  85. }
  86. return TRUE;
  87. }