test: sbapi.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# sbapi.c

Go to the documentation of this file.

    00001 /**************************** Module Header ********************************\
    00002 * Module Name:
    00003 *
    00004 * Copyright (c) 1985 - 1999, Microsoft Corporation
    00005 *
    00006 * Scroll bar public APIs
    00007 *
    00008 * History:
    00009 *   11/21/90 JimA      Created.
    00010 *   01-31-91 IanJa     Revalidaion added
    00011 \***************************************************************************/
    00012
    00013 #include "precomp.h"
    00014 #pragma hdrstop
    00015
    00016 /***************************************************************************\
    00017 * xxxShowScrollBar
    00018 *
    00019 * Shows and hides standard scroll bars or scroll bar controls. If wBar is
    00020 * SB_HORZ, SB_VERT, or SB_BOTH, pwnd is assumed to be the handle of the window
    00021 * which has the standard scroll bars as styles. If wBar is SB_CTL, pwnd is
    00022 * assumed to be the handle of the scroll bar control.
    00023 *
    00024 * It does not destroy pwnd->rgwScroll like xxxSetScrollBar() does, so that the
    00025 * app can hide a standard scroll bar and then show it, without having to reset
    00026 * the range and thumbposition.
    00027 *
    00028 * History:
    00029 * 16-May-1991 mikeke    Changed to return BOOL
    00030 \***************************************************************************/
    00031
    00032 BOOL xxxShowScrollBar(
    00033     PWND pwnd,
    00034     UINT wBar,      /* SB_HORZ, SB_VERT, SB_BOTH , SB_CTL */
    00035     BOOL fShow)     /* Show or Hide. */
    00036 {
    00037     BOOL fChanged = FALSE;
    00038     DWORD   dwStyle;
    00039
    00040     CheckLock(pwnd);
    00041
    00042     switch (wBar)
    00043     {
    00044     case SB_CTL:
    00045         {
    00046
    00047             xxxShowWindow(
    00048                     pwnd,
    00049                     (fShow ? SHOW_OPENWINDOW : HIDE_WINDOW) | TEST_PUDF(PUDF_ANIMATE));
    00050
    00051             return(TRUE);
    00052         }
    00053
    00054     case SB_HORZ:
    00055         dwStyle = WS_HSCROLL;
    00056         break;
    00057
    00058     case SB_VERT:
    00059         dwStyle = WS_VSCROLL;
    00060         break;
    00061
    00062     case SB_BOTH:
    00063         dwStyle = WS_HSCROLL | WS_VSCROLL;
    00064         break;
    00065     }
    00066
    00067     if (!fShow)
    00068     {
    00069         if (pwnd->style & dwStyle)
    00070         {
    00071             fChanged = TRUE;
    00072             pwnd->style &= ~dwStyle;
    00073         }
    00074     } else {
    00075         if ((pwnd->style & dwStyle) != dwStyle)
    00076         {
    00077             fChanged = TRUE;
    00078             pwnd->style |= dwStyle;
    00079         }
    00080
    00081         /*
    00082          * Make sure that pwsb is initialized.
    00083          */
    00084         if (pwnd->pSBInfo == NULL)
    00085             _InitPwSB(pwnd);
    00086     }
    00087
    00088     /*
    00089      * If the state changed, redraw the frame and force WM_NCPAINT.
    00090      */
    00091     if (fChanged) {
    00092
    00093         /*
    00094          * We always redraw even if minimized or hidden...  Otherwise, it seems
    00095          * the scroll bars aren't properly hidden/shown when we become
    00096          * visible
    00097          */
    00098         xxxRedrawFrame(pwnd);
    00099     }
    00100     return TRUE;
    00101 }