test: drawfrm.c Source File

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

# drawfrm.c

Go to the documentation of this file.

    00001 /****************************** Module Header ******************************\
    00002 * Module Name: drawfrm.c
    00003 *
    00004 * Copyright (c) 1985 - 1999, Microsoft Corporation
    00005 *
    00006 * Window Frame Drawing Routines. (aka wmframe.c)
    00007 *
    00008 * History:
    00009 * 10-22-90 MikeHar    Ported functions from Win 3.0 sources.
    00010 * 13-Feb-1991 mikeke    Added Revalidation code
    00011 \***************************************************************************/
    00012
    00013 #include "precomp.h"
    00014 #pragma hdrstop
    00015
    00016
    00017 /***************************************************************************\
    00018 * BitBltSysBmp
    00019 *
    00020 \***************************************************************************/
    00021
    00022 BOOL FAR BitBltSysBmp(
    00023     HDC          hdc,
    00024     int          x,
    00025     int          y,
    00026     UINT         i
    00027     )
    00028 {
    00029     BOOL bRet;
    00030     POEMBITMAPINFO pOem = gpsi->oembmi + i;
    00031
    00032     bRet = GreBitBlt(hdc,
    00033                      x,
    00034                      y,
    00035                      pOem->cx,
    00036                      pOem->cy,
    00037                      HDCBITS(),
    00038                      pOem->x,
    00039                      pOem->y,
    00040                      SRCCOPY,
    00041                      0);
    00042 #ifdef USE_MIRRORING
    00043     /*
    00044      * If the UI language is Hebrew we do not want to mirror the ? mark only
    00045      * Then redraw ? with out the button frame.
    00046      */
    00047     if (HEBREW_UI_LANGID() && MIRRORED_HDC(hdc)) {
    00048         if ((i >= OBI_HELP) && (i <= OBI_HELP_H)) {
    00049             if (i == OBI_HELP_D) {
    00050                 x = x + SYSMET(CXEDGE);
    00051             }
    00052             bRet = GreBitBlt(hdc,
    00053                              x,
    00054                              y+SYSMET(CXEDGE),
    00055                              pOem->cx-SYSMET(CXEDGE)*2,
    00056                              pOem->cy-SYSMET(CXEDGE)*2,
    00057                              HDCBITS(),
    00058                              pOem->x+SYSMET(CXEDGE),
    00059                              pOem->y+SYSMET(CXEDGE),
    00060                              SRCCOPY|NOMIRRORBITMAP,
    00061                              0);
    00062
    00063         }
    00064     }
    00065 #endif
    00066     return bRet;
    00067 }
    00068
    00069 /***************************************************************************\
    00070 * xxxDrawWindowFrame
    00071 *
    00072 * History:
    00073 * 10-24-90 MikeHar      Ported from WaWaWaWindows.
    00074 \***************************************************************************/
    00075
    00076 void xxxDrawWindowFrame(
    00077     PWND pwnd,
    00078     HDC  hdc,
    00079     BOOL fHungRedraw,
    00080     BOOL fActive)
    00081 {
    00082     RECT    rcClip;
    00083     int cxFrame, cyFrame;
    00084     UINT    wFlags = DC_NC;
    00085
    00086     CheckLock(pwnd);
    00087
    00088     /*
    00089      * If we are minimized, or if a parent is minimized or invisible,
    00090      * we've got nothing to draw.
    00091      */
    00092     if (!IsVisible(pwnd) ||
    00093         (TestWF(pwnd, WFNONCPAINT) && !TestWF(pwnd, WFMENUDRAW)) ||
    00094         EqualRect(&pwnd->rcWindow, &pwnd->rcClient)) {
    00095         return;
    00096     }
    00097
    00098     /*
    00099      * If the update rgn is not NULL, we may have to invalidate the bits saved.
    00100      */
    00101 //    if (TRUE) {
    00102     if (pwnd->hrgnUpdate > NULL || GreGetClipBox(hdc, &rcClip, TRUE) != NULLREGION) {
    00103         RECT rcWindow;
    00104         int  cBorders;
    00105
    00106         if (TestWF(pwnd, WFMINIMIZED) && !TestWF(pwnd, WFNONCPAINT)) {
    00107             if (TestWF(pwnd, WFFRAMEON))
    00108                 wFlags |= DC_ACTIVE;
    00109             if (fHungRedraw)
    00110                 wFlags |= DC_NOSENDMSG;
    00111             xxxDrawCaptionBar(pwnd, hdc, wFlags);
    00112             return;
    00113         }
    00114
    00115         cxFrame = cyFrame = cBorders =
    00116             GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE);
    00117         cxFrame *= SYSMET(CXBORDER);
    00118         cyFrame *= SYSMET(CYBORDER);
    00119
    00120         GetRect(pwnd, &rcWindow, GRECT_WINDOW | GRECT_WINDOWCOORDS);
    00121         InflateRect(&rcWindow, -cxFrame, -cyFrame);
    00122
    00123         /*
    00124          * If the menu style is present, draw it.
    00125          */
    00126         if (TestWF(pwnd, WFMPRESENT) && !fHungRedraw) {
    00127             rcWindow.top += xxxMenuBarDraw(pwnd, hdc, cxFrame, cyFrame);
    00128         }
    00129
    00130         /*
    00131          * Draw the title bar if the window has a caption or any window
    00132          * borders.  Punt if the NONCPAINT bit is set, because that means
    00133          * we're going to draw the frame a little bit later.
    00134          */
    00135
    00136         if ((TestWF(pwnd, WFBORDERMASK) != 0
    00137                 || TestWF(pwnd, WEFDLGMODALFRAME))
    00138                 || TestWF(pwnd, WFSIZEBOX)
    00139                 || TestWF(pwnd, WEFWINDOWEDGE)
    00140                 || TestWF(pwnd, WEFSTATICEDGE)
    00141             && !TestWF(pwnd, WFNONCPAINT))
    00142         {
    00143             if (fHungRedraw)
    00144                 wFlags |= DC_NOSENDMSG;
    00145             if (fActive)
    00146                 wFlags |= DC_ACTIVE;
    00147             xxxDrawCaptionBar(pwnd, hdc, wFlags | DC_NOVISIBLE);
    00148         }
    00149
    00150         //
    00151         // Subtract out caption if present.
    00152         //
    00153         rcWindow.top += GetCaptionHeight(pwnd);
    00154
    00155         //
    00156         // Draw client edge
    00157         //
    00158         if (TestWF(pwnd, WFCEPRESENT)) {
    00159             cxFrame += SYSMET(CXEDGE);
    00160             cyFrame += SYSMET(CYEDGE);
    00161             DrawEdge(hdc, &rcWindow, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
    00162         }
    00163
    00164         //
    00165         // Since scrolls don't have to use tricks to overlap the window
    00166         // border anymore, we don't have to worry about borders.
    00167         //
    00168         if (TestWF(pwnd, WFVPRESENT) && !fHungRedraw) {
    00169             if (TestWF(pwnd, WFHPRESENT)) {
    00170                 // This accounts for client borders.
    00171                 DrawSize(pwnd, hdc, cxFrame, cyFrame);
    00172             }
    00173
    00174             xxxDrawScrollBar(pwnd, hdc, TRUE);
    00175         }
    00176
    00177         if (TestWF(pwnd, WFHPRESENT) && !fHungRedraw)
    00178             xxxDrawScrollBar(pwnd, hdc, FALSE);
    00179     }
    00180 }
    00181
    00182
    00183 /***************************************************************************\
    00184 * xxxRedrawFrame
    00185 *
    00186 * Called by scrollbars and menus to redraw a windows scroll bar or menu.
    00187 *
    00188 * History:
    00189 * 10-24-90 MikeHar Ported from WaWaWaWindows.
    00190 \***************************************************************************/
    00191
    00192 void xxxRedrawFrame(
    00193     PWND pwnd)
    00194 {
    00195     CheckLock(pwnd);
    00196
    00197     /*
    00198      * We always want to call xxxSetWindowPos, even if invisible or iconic,
    00199      * because we need to make sure the WM_NCCALCSIZE message gets sent.
    00200      */
    00201     xxxSetWindowPos(pwnd, NULL, 0, 0, 0, 0, SWP_NOZORDER |
    00202             SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME);
    00203 }
    00204
    00205 void xxxRedrawFrameAndHook(
    00206     PWND pwnd)
    00207 {
    00208     CheckLock(pwnd);
    00209
    00210     /*
    00211      * We always want to call xxxSetWindowPos, even if invisible or iconic,
    00212      * because we need to make sure the WM_NCCALCSIZE message gets sent.
    00213      */
    00214     xxxSetWindowPos(pwnd, NULL, 0, 0, 0, 0, SWP_NOZORDER |
    00215             SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME);
    00216     if ( IsTrayWindow(pwnd) ) {
    00217         HWND hw = HWq(pwnd);
    00218         xxxCallHook(HSHELL_REDRAW, (WPARAM)hw, 0L, WH_SHELL);
    00219         PostShellHookMessages(HSHELL_REDRAW, (LPARAM)hw);
    00220
    00221     }
    00222 }