Ignore:
Timestamp:
Dec 5, 2002, 9:36:28 PM (23 years ago)
Author:
umoeller
Message:

New toolbar control.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/winh.c

    r229 r232  
    271271/* ******************************************************************
    272272 *
     273 *   Global variables
     274 *
     275 ********************************************************************/
     276
     277extern LONG G_cxScreen = 0,
     278            G_cyScreen = 0,
     279            G_cxIcon = 0,
     280            G_cyIcon = 0,
     281            G_lcol3DDark = 0,         // lo-3D color
     282            G_lcol3DLight = 0;        // hi-3D color
     283
     284/* ******************************************************************
     285 *
    273286 *   Generics
    274287 *
    275288 ********************************************************************/
     289
     290/*
     291 *@@ winhInitGlobals:
     292 *      initializes a few global variables that are usually
     293 *      used all the time in many applications and also
     294 *      internally by many helper routines. You must call
     295 *      this at the start of your application if you want
     296 *      to use these.
     297 *
     298 *@@added V1.0.1 (2002-11-30) [umoeller]
     299 */
     300
     301VOID winhInitGlobals(VOID)
     302{
     303    G_cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
     304    G_cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
     305    G_cxIcon = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
     306    G_cyIcon = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
     307    G_lcol3DDark = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0);
     308    G_lcol3DLight = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0);
     309}
    276310
    277311/*
     
    28052839        // if (xNew + swpThis.cy > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
    28062840                // not cy, but cx V1.0.0 (2002-08-26) [umoeller]
    2807         if (xNew + swpThis.cx > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
     2841        if (xNew + swpThis.cx > G_cxScreen)
    28082842        {
    28092843            // place left then
     
    29022936
    29032937/*
     2938 *@@ winhQueryDefaultFont:
     2939 *
     2940 *@@added V1.0.1 (2002-11-30) [umoeller]
     2941 */
     2942
     2943PCSZ winhQueryDefaultFont(VOID)
     2944{
     2945    if (doshIsWarp4())
     2946        return "9.WarpSans";
     2947
     2948    return "8.Helv";
     2949}
     2950
     2951/*
    29042952 *@@ winhSetWindowFont:
    29052953 *      this sets a window's font by invoking
     
    29142962 *
    29152963 *@@added V0.9.0 [umoeller]
     2964 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized
    29162965 */
    29172966
     
    29192968                       const char *pcszFont)
    29202969{
    2921     CHAR    szFont[256];
    2922 
    2923     if (pcszFont == NULL)
    2924     {
    2925         if (doshIsWarp4())
    2926             strhncpy0(szFont, "9.WarpSans", sizeof(szFont));
    2927         else
    2928             strhncpy0(szFont, "8.Helv", sizeof(szFont));
    2929     }
    2930     else
    2931         strhncpy0(szFont, pcszFont, sizeof(szFont));
     2970    if (!pcszFont)
     2971        pcszFont = winhQueryDefaultFont();
    29322972
    29332973    return WinSetPresParam(hwnd,
    29342974                           PP_FONTNAMESIZE,
    2935                            strlen(szFont)+1,
    2936                            szFont);
     2975                           strlen(pcszFont) + 1,
     2976                           (PSZ)pcszFont);
    29372977}
    29382978
     
    30823122        }
    30833123    }
     3124
    30843125    return brc;
     3126}
     3127
     3128/*
     3129 *@@ winhCreateDefaultPresparams:
     3130 *
     3131 *      Caller must free() the return value.
     3132 *
     3133 *@@added V1.0.1 (2002-11-30) [umoeller]
     3134 */
     3135
     3136PPRESPARAMS winhCreateDefaultPresparams(VOID)
     3137{
     3138    PPRESPARAMS ppp = NULL;
     3139
     3140    PCSZ    pcszFont = winhQueryDefaultFont();
     3141    LONG    lColor;
     3142
     3143    winhStorePresParam(&ppp,
     3144                       PP_FONTNAMESIZE,
     3145                       strlen(pcszFont) + 1,
     3146                       (PVOID)pcszFont);
     3147
     3148    lColor = WinQuerySysColor(HWND_DESKTOP,
     3149                              SYSCLR_DIALOGBACKGROUND,
     3150                              0);
     3151    winhStorePresParam(&ppp,
     3152                       PP_BACKGROUNDCOLOR,
     3153                       sizeof(lColor),
     3154                       &lColor);
     3155
     3156    lColor = RGBCOL_BLACK;
     3157    winhStorePresParam(&ppp,
     3158                       PP_FOREGROUNDCOLOR,
     3159                       sizeof(lColor),
     3160                       &lColor);
     3161
     3162    return ppp;
    30853163}
    30863164
     
    34973575
    34983576/*
    3499  *@@ winhMyAnchorBlock:
    3500  *      returns the proper anchor block (HAB)
    3501  *      for the calling thread.
    3502  *
    3503  *      Many Win* functions require an HAB to be
    3504  *      passed in. While many of them will work
    3505  *      when passing in NULLHANDLE, some (such as
    3506  *      WinGetMsg) won't. If you don't know the
    3507  *      anchor block of the calling thread, use
    3508  *      this function.
    3509  *
    3510  *      This creates a temporary object window to
    3511  *      find out the anchor block. This is quite
    3512  *      expensive so only use this if there's no
    3513  *      other way to find out.
    3514  *
    3515  *@@added V0.9.11 (2001-04-20) [umoeller]
    3516  */
    3517 
    3518 HAB winhMyAnchorBlock(VOID)
    3519 {
    3520     HAB hab = NULLHANDLE;
    3521     HWND hwnd;
    3522     if (hwnd = winhCreateObjectWindow(WC_BUTTON, NULL))
    3523     {
    3524         hab = WinQueryAnchorBlock(hwnd);
    3525         WinDestroyWindow(hwnd);
    3526     }
    3527 
    3528     return hab;
    3529 }
    3530 
    3531 /*
    35323577 *@@ winhFree:
    35333578 *      frees a block of memory allocated by the
     
    37283773
    37293774/*
     3775 *@@ winhQueryWaitPointer:
     3776 *      shortcut for getting the system "wait" pointer.
     3777 *
     3778 *@@added V1.0.1 (2002-11-30) [umoeller]
     3779 */
     3780
     3781HPOINTER winhQueryWaitPointer(VOID)
     3782{
     3783    return WinQuerySysPointer(HWND_DESKTOP,
     3784                              SPTR_WAIT,
     3785                              FALSE);   // no copy
     3786}
     3787
     3788/*
    37303789 *@@ winhSetWaitPointer:
    37313790 *      this sets the mouse pointer to "Wait".
     
    37423801    HPOINTER hptr = WinQueryPointer(HWND_DESKTOP);
    37433802    WinSetPointer(HWND_DESKTOP,
    3744                   WinQuerySysPointer(HWND_DESKTOP,
    3745                                      SPTR_WAIT,
    3746                                      FALSE));   // no copy
     3803                  winhQueryWaitPointer());
    37473804    return hptr;
    37483805}
     
    37603817{
    37613818    PSZ     pszText = NULL;
    3762     ULONG   cbText = WinQueryWindowTextLength(hwnd);
    3763                                     // additional null character
    3764     if (cbText)
    3765     {
    3766         if (pszText = (PSZ)malloc(cbText + 1))
     3819    ULONG   cbText;
     3820    if (cbText = WinQueryWindowTextLength(hwnd))
     3821    {
     3822        if (pszText = (PSZ)malloc(cbText + 1))  // additional null character
    37673823            WinQueryWindowText(hwnd,
    37683824                               cbText + 1,
    37693825                               pszText);
    37703826    }
     3827
    37713828    return pszText;
    37723829}
     
    38213878{
    38223879    BOOL    brc = FALSE;
    3823     PSZ     pszText = winhQueryWindowText(hwnd);
    3824     if (pszText)
     3880    PSZ     pszText;
     3881
     3882    if (pszText = winhQueryWindowText(hwnd))
    38253883    {
    38263884        ULONG ulOfs = 0;
     
    38303888            brc = TRUE;
    38313889        }
     3890
    38323891        free(pszText);
    38333892    }
     3893
    38343894    return brc;
    38353895}
     
    39393999 *@@changed V0.9.5 (2000-08-13) [umoeller]: flStyleClient never worked, fixed
    39404000 *@@changed V0.9.7 (2000-12-08) [umoeller]: fixed client calc for invisible window
     4001 *@@changed V1.0.1 (2002-11-30) [umoeller]: added support for NULL pcszClassClient
    39414002 */
    39424003
     
    39474008                         const char *pcszFrameTitle, // in: frame title (title bar)
    39484009                         ULONG ulResourcesID,       // in: according to FCF_* flags
    3949                          const char *pcszClassClient, // in: client class name
     4010                         const char *pcszClassClient, // in: client class name (can be NULL for no client)
    39504011                         ULONG flStyleClient,       // in: client style
    39514012                         ULONG ulID,                // in: frame window ID
    39524013                         PVOID pClientCtlData,      // in: pCtlData structure pointer for client
    3953                          PHWND phwndClient)         // out: created client wnd
     4014                         PHWND phwndClient)         // out: created client wnd (required)
    39544015{
    39554016    FRAMECDATA  fcdata;
     
    39624023    fcdata.idResources   = ulResourcesID;
    39634024
    3964     /* Create the frame and client windows.  */
    3965     hwndFrame = WinCreateWindow(hwndFrameParent,
    3966                                 WC_FRAME,
    3967                                 (PSZ)pcszFrameTitle,
    3968                                 ulFrameStyle,
    3969                                 0,0,0,0,         // size and position = 0
    3970                                 NULLHANDLE,      // no owner
    3971                                 HWND_TOP,        // z-order
    3972                                 ulID,            // frame window ID
    3973                                 &fcdata,         // frame class data
    3974                                 NULL);           // no presparams
    3975 
    3976     if (hwndFrame)
    3977     {
    3978         if (*phwndClient = WinCreateWindow(hwndFrame,      // parent
    3979                                            (PSZ)pcszClassClient, // class
    3980                                            NULL,           // no title
    3981                                            flStyleClient,  // style
    3982                                            0,0,0,0,        // size and position = 0
    3983                                            hwndFrame,      // owner
    3984                                            HWND_BOTTOM,    // bottom z-order
    3985                                            FID_CLIENT,     // frame window ID
    3986                                            pClientCtlData, // class data
    3987                                            NULL))          // no presparams
     4025    // create the frame and client windows
     4026    if (hwndFrame = WinCreateWindow(hwndFrameParent,
     4027                                    WC_FRAME,
     4028                                    (PSZ)pcszFrameTitle,
     4029                                    ulFrameStyle,
     4030                                    0,0,0,0,
     4031                                    NULLHANDLE,
     4032                                    HWND_TOP,
     4033                                    ulID,
     4034                                    &fcdata,
     4035                                    NULL))
     4036    {
     4037        if (    (!pcszClassClient)          // V1.0.1 (2002-11-30) [umoeller]
     4038             || (*phwndClient = WinCreateWindow(hwndFrame,      // parent
     4039                                                (PSZ)pcszClassClient, // class
     4040                                                NULL,           // no title
     4041                                                flStyleClient,  // style
     4042                                                0,0,0,0,        // size and position = 0
     4043                                                hwndFrame,      // owner
     4044                                                HWND_BOTTOM,    // bottom z-order
     4045                                                FID_CLIENT,     // frame window ID
     4046                                                pClientCtlData, // class data
     4047                                                NULL))          // no presparams
     4048           )
    39884049        {
    39894050            if (pswpFrame)
     
    39984059                                pswpFrame->fl);
    39994060
    4000                 // position client
    4001                 // WinQueryWindowRect(hwndFrame, &rclClient);
    4002                 // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller]
    4003                 rclClient.xLeft = 0;
    4004                 rclClient.yBottom = 0;
    4005                 rclClient.xRight = pswpFrame->cx;
    4006                 rclClient.yTop = pswpFrame->cy;
    4007                 WinCalcFrameRect(hwndFrame,
    4008                                  &rclClient,
    4009                                  TRUE);     // calc client from frame
    4010                 WinSetWindowPos(*phwndClient,
    4011                                 HWND_TOP,
    4012                                 rclClient.xLeft,
    4013                                 rclClient.yBottom,
    4014                                 rclClient.xRight - rclClient.xLeft,
    4015                                 rclClient.yTop - rclClient.yBottom,
    4016                                 SWP_MOVE | SWP_SIZE | SWP_SHOW);
     4061                if (!pcszClassClient)
     4062                    *phwndClient = NULLHANDLE;
     4063                else
     4064                {
     4065                    // position client
     4066                    // WinQueryWindowRect(hwndFrame, &rclClient);
     4067                    // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller]
     4068                    rclClient.xLeft = 0;
     4069                    rclClient.yBottom = 0;
     4070                    rclClient.xRight = pswpFrame->cx;
     4071                    rclClient.yTop = pswpFrame->cy;
     4072                    WinCalcFrameRect(hwndFrame,
     4073                                     &rclClient,
     4074                                     TRUE);     // calc client from frame
     4075                    WinSetWindowPos(*phwndClient,
     4076                                    HWND_TOP,
     4077                                    rclClient.xLeft,
     4078                                    rclClient.yBottom,
     4079                                    rclClient.xRight - rclClient.xLeft,
     4080                                    rclClient.yTop - rclClient.yBottom,
     4081                                    SWP_MOVE | SWP_SIZE | SWP_SHOW);
     4082                }
    40174083            }
    40184084        }
     
    41194185        if (WinQueryClassName(hwndThis, sizeof(szClass), szClass))
    41204186        {
    4121             if (strcmp(szClass, "#32767") == 0)
     4187            if (!strcmp(szClass, "#32767"))
    41224188            {
    41234189                // message queue window:
     
    41324198                {
    41334199                    // get HMQ from window words
    4134                     rc = WinQueryWindowULong(hwndThis, QWL_HMQ);
    4135                     if (rc)
     4200                    if (rc = WinQueryWindowULong(hwndThis, QWL_HMQ))
    41364201                        if (phab)
    41374202                            *phab = WinQueryAnchorBlock(hwndThis);
     4203
    41384204                    break;
    41394205                }
     
    41784244    // enumerate all child windows of HWND_OBJECT
    41794245    henumObject = WinBeginEnumWindows(HWND_OBJECT);
    4180     while ((hwndObjectChild = WinGetNextWindow(henumObject)) != NULLHANDLE)
     4246    while ((hwndObjectChild = WinGetNextWindow(henumObject)))
    41814247    {
    41824248        // see if the current HWND_OBJECT child window runs in the
     
    42724338                           WS_VISIBLE,    // window style
    42734339                           0, 0,          // position and size
    4274                            WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN),
    4275                            WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN),
     4340                           G_cxScreen,
     4341                           G_cyScreen,
    42764342                           NULLHANDLE,    // owner window
    42774343                           hwndSibling,   // sibling window
     
    44264492 *         was encountered.
    44274493 *
    4428  *      You can specify DT_QUERYEXTENT with flDraw to only have
    4429  *      these text boundaries calculated without actually drawing.
     4494 *      The following DT_* flags are supported:
     4495 *
     4496 *      --  DT_LEFT, DT_CENTER, DT_RIGHT all work.
     4497 *
     4498 *      --  Vertically however only DT_TOP is supported.
     4499 *
     4500 *      --  You can specify DT_QUERYEXTENT to only have
     4501 *          these text boundaries calculated without actually
     4502 *          drawing.
     4503 *
     4504 *      Note that DT_TEXTATTRS will always be added, so you
     4505 *      will want to call GpiSetColor before this.
    44304506 *
    44314507 *      This returns the number of lines drawn.
    4432  *
    4433  *      Note that this calls WinDrawText with DT_TEXTATTRS set,
    4434  *      that is, the current text primitive attributes will be
    4435  *      used (fonts and colors).
    44364508 *
    44374509 *@@changed V0.9.0 [umoeller]: prcl.xLeft and xRight are now updated too upon return
     
    44434515                                         // (modified)
    44444516                            const char *pcszText, // in: text to draw (zero-terminated)
    4445                             ULONG flCmd) // in: flags like in WinDrawText; I have
    4446                                          // only tested DT_TOP and DT_LEFT though.
    4447                                          // DT_WORDBREAK | DT_TEXTATTRS are always
    4448                                          // set.
    4449                                          // You can specify DT_QUERYEXTENT to only
    4450                                          // have prcl calculated without drawing.
     4517                            ULONG flCmd) // in: DT_* flags like in WinDrawText; see remarks
    44514518{
    44524519    PSZ     p = (PSZ)pcszText;
     
    44724539        memcpy(&rcl2, prcl, sizeof(rcl2));
    44734540        lDrawn = WinDrawText(hps,
    4474                              ulTextLen-lTotalDrawn,
     4541                             ulTextLen - lTotalDrawn,
    44754542                             p,
    44764543                             &rcl2,
    4477                              0, 0,                       // colors
     4544                             0,
     4545                             0,                       // colors
    44784546                             flCmd2);
    44794547
     
    44944562        lLineCount++;
    44954563    }
     4564
    44964565    prcl->xLeft = xLeftmost;
    44974566    prcl->xRight = xRightmost;
     
    45214590PSWBLOCK winhQuerySwitchList(HAB hab)
    45224591{
    4523     ULONG   cItems = WinQuerySwitchList(hab, NULL, 0);
    4524     ULONG   ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH);
    4525     PSWBLOCK pSwBlock = (PSWBLOCK)malloc(ulBufSize);
    4526     if (pSwBlock)
    4527     {
    4528         cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize);
    4529         if (!cItems)
     4592    ULONG       cItems = WinQuerySwitchList(hab, NULL, 0);
     4593    ULONG       ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH);
     4594    PSWBLOCK    pSwBlock;
     4595    if (pSwBlock = (PSWBLOCK)malloc(ulBufSize))
     4596    {
     4597        if (!(cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize)))
    45304598        {
    45314599            free(pSwBlock);
     
    47474815                    &ShiftState, DataLen, &DataLen,
    47484816                    NULL, 0L, NULL);
     4817
    47494818        // now close OS/2 keyboard driver
    47504819        DosClose(hKbd);
    47514820    }
    4752     return;
    47534821}
    47544822
     
    47984866
    47994867/*
    4800  *@@category: Helpers\PM helpers\Extended frame windows
    4801  */
    4802 
    4803 /* ******************************************************************
    4804  *
    4805  *   Extended frame
    4806  *
    4807  ********************************************************************/
    4808 
    4809 /*
    4810  *@@ winhCalcExtFrameRect:
    4811  *      implementation for WM_CALCFRAMERECT in fnwpSubclExtFrame.
    4812  *      This is exported so it can be used independently
    4813  *      (XWorkplace status bars).
    4814  *
    4815  *@@added V1.0.0 (2002-08-28) [umoeller]
    4816  */
    4817 
    4818 VOID winhCalcExtFrameRect(MPARAM mp1,
    4819                           MPARAM mp2,
    4820                           LONG lStatusBarHeight)
    4821 {
    4822     PRECTL prclPassed = (PRECTL)mp1;
    4823 
    4824     // mp2 == TRUE:  Frame rectangle provided, calculate client
    4825     // mp2 == FALSE: Client area rectangle provided, calculate frame
    4826     if (mp2)
    4827     {
    4828         //  TRUE: calculate the rectl of the client;
    4829         //  call default window procedure to subtract child frame
    4830         //  controls from the rectangle's height
    4831         LONG lClientHeight;
    4832 
    4833         //  position the static text frame extension below the client
    4834         lClientHeight = prclPassed->yTop - prclPassed->yBottom;
    4835         if (lStatusBarHeight > lClientHeight)
    4836             // extension is taller than client, so set client height to 0
    4837             prclPassed->yTop = prclPassed->yBottom;
    4838         else
    4839         {
    4840             //  set the origin of the client and shrink it based upon the
    4841             //  static text control's height
    4842             prclPassed->yBottom += lStatusBarHeight;
    4843             prclPassed->yTop -= lStatusBarHeight;
    4844         }
    4845     }
    4846     else
    4847     {
    4848         //  FALSE: calculate the rectl of the frame;
    4849         //  call default window procedure to subtract child frame
    4850         //  controls from the rectangle's height;
    4851         //  set the origin of the frame and increase it based upon the
    4852         //  static text control's height
    4853         prclPassed->yBottom -= lStatusBarHeight;
    4854         prclPassed->yTop += lStatusBarHeight;
    4855     }
    4856 }
    4857 
    4858 #define STATUS_BAR_HEIGHT       20
    4859 
    4860 /*
    4861  *@@ fnwpSubclExtFrame:
    4862  *      subclassed frame window proc.
    4863  *
    4864  *@@added V0.9.16 (2001-09-29) [umoeller]
    4865  */
    4866 
    4867 MRESULT EXPENTRY fnwpSubclExtFrame(HWND hwndFrame, ULONG msg, MPARAM mp1, MPARAM mp2)
    4868 {
    4869     MRESULT mrc = 0;
    4870 
    4871     PEXTFRAMEDATA pData = (PEXTFRAMEDATA)WinQueryWindowPtr(hwndFrame, QWL_USER);
    4872 
    4873     switch (msg)
    4874     {
    4875         case WM_QUERYFRAMECTLCOUNT:
    4876         {
    4877             // query the standard frame controls count
    4878             ULONG ulrc = (ULONG)pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    4879 
    4880             // if we have a status bar, increment the count
    4881             ulrc++;
    4882 
    4883             mrc = (MPARAM)ulrc;
    4884         }
    4885         break;
    4886 
    4887         case WM_FORMATFRAME:
    4888         {
    4889             // query the number of standard frame controls
    4890             ULONG ulCount = (ULONG)pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    4891 
    4892             // we have a status bar:
    4893             // format the frame
    4894             ULONG       ul;
    4895             PSWP        swpArr = (PSWP)mp1;
    4896 
    4897             for (ul = 0; ul < ulCount; ul++)
    4898             {
    4899                 if (WinQueryWindowUShort(swpArr[ul].hwnd, QWS_ID) == 0x8008)
    4900                                                                  // FID_CLIENT
    4901                 {
    4902                     POINTL      ptlBorderSizes;
    4903                     WinSendMsg(hwndFrame,
    4904                                WM_QUERYBORDERSIZE,
    4905                                (MPARAM)&ptlBorderSizes,
    4906                                0);
    4907 
    4908                     // first initialize the _new_ SWP for the status bar.
    4909                     // Since the SWP array for the std frame controls is
    4910                     // zero-based, and the standard frame controls occupy
    4911                     // indices 0 thru ulCount-1 (where ulCount is the total
    4912                     // count), we use ulCount for our static text control.
    4913                     swpArr[ulCount].fl = SWP_MOVE | SWP_SIZE | SWP_NOADJUST | SWP_ZORDER;
    4914                     swpArr[ulCount].x  = ptlBorderSizes.x;
    4915                     swpArr[ulCount].y  = ptlBorderSizes.y;
    4916                     swpArr[ulCount].cx = swpArr[ul].cx;  // same as cnr's width
    4917                     swpArr[ulCount].cy = STATUS_BAR_HEIGHT;
    4918                     swpArr[ulCount].hwndInsertBehind = HWND_BOTTOM; // HWND_TOP;
    4919                     swpArr[ulCount].hwnd = WinWindowFromID(hwndFrame, FID_STATUSBAR);
    4920 
    4921                     // adjust the origin and height of the container to
    4922                     // accomodate our static text control
    4923                     swpArr[ul].y  += swpArr[ulCount].cy;
    4924                     swpArr[ul].cy -= swpArr[ulCount].cy;
    4925                 }
    4926             }
    4927 
    4928             // increment the number of frame controls
    4929             // to include our status bar
    4930             mrc = (MRESULT)(ulCount + 1);
    4931         }
    4932         break;
    4933 
    4934         case WM_CALCFRAMERECT:
    4935             mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    4936 
    4937             // we have a status bar: calculate its rectangle
    4938             winhCalcExtFrameRect(mp1,
    4939                                  mp2,
    4940                                  STATUS_BAR_HEIGHT);
    4941         break;
    4942 
    4943         case WM_DESTROY:
    4944             WinSubclassWindow(hwndFrame, pData->pfnwpOrig);
    4945             free(pData);
    4946             WinSetWindowPtr(hwndFrame, QWL_USER, NULL);
    4947         break;
    4948 
    4949         default:
    4950             mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    4951     }
    4952 
    4953     return mrc;
    4954 }
    4955 
    4956 /*
    4957  *@@ winhCreateStatusBar:
    4958  *      creates a status bar for a frame window.
    4959  *
    4960  *      Normally there's no need to call this manually,
    4961  *      this gets called by winhCreateExtStdWindow
    4962  *      automatically.
    4963  *
    4964  *@@added V0.9.16 (2001-09-29) [umoeller]
    4965  */
    4966 
    4967 HWND winhCreateStatusBar(HWND hwndFrame,
    4968                          HWND hwndOwner,
    4969                          const char *pcszText,      // in: initial status bar text
    4970                          const char *pcszFont,      // in: font to use for status bar
    4971                          LONG lColor)               // in: foreground color for status bar
    4972 {
    4973     // create status bar
    4974     HWND        hwndReturn = NULLHANDLE;
    4975     PPRESPARAMS ppp = NULL;
    4976 
    4977     winhStorePresParam(&ppp,
    4978                        PP_FONTNAMESIZE,
    4979                        strlen(pcszFont) + 1,
    4980                        (PVOID)pcszFont);
    4981 
    4982     lColor = WinQuerySysColor(HWND_DESKTOP,
    4983                               SYSCLR_DIALOGBACKGROUND,
    4984                               0);
    4985     winhStorePresParam(&ppp,
    4986                        PP_BACKGROUNDCOLOR,
    4987                        sizeof(lColor),
    4988                        &lColor);
    4989 
    4990     lColor = CLR_BLACK;
    4991     winhStorePresParam(&ppp,
    4992                        PP_FOREGROUNDCOLOR,
    4993                        sizeof(lColor),
    4994                        &lColor);
    4995 
    4996     hwndReturn = WinCreateWindow(hwndFrame,
    4997                                  WC_STATIC,
    4998                                  (PSZ)pcszText,
    4999                                  SS_TEXT | DT_VCENTER | WS_VISIBLE,
    5000                                  0, 0, 0, 0,
    5001                                  hwndOwner,
    5002                                  HWND_TOP,
    5003                                  FID_STATUSBAR,
    5004                                  NULL,
    5005                                  ppp);
    5006     free(ppp);
    5007 
    5008     return hwndReturn;
    5009 }
    5010 
    5011 /*
    5012  *@@ winhCreateExtStdWindow:
    5013  *      creates an extended frame window.
    5014  *
    5015  *      pData must point to an EXTFRAMECDATA structure
    5016  *      which contains a copy of the parameters to be
    5017  *      passed to winhCreateStdWindow. In addition,
    5018  *      this contains the flExtFlags field, which allows
    5019  *      you to automatically create a status bar for
    5020  *      the window.
    5021  *
    5022  *      Note that we subclass the frame here and require
    5023  *      QWL_USER for that. The frame's QWL_USER points
    5024  *      to an EXTFRAMEDATA structure whose pUser parameter
    5025  *      you may use for additional data, if you want to
    5026  *      do further subclassing.
    5027  *
    5028  *@@added V0.9.16 (2001-09-29) [umoeller]
    5029  */
    5030 
    5031 HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData,        // in: extended frame data
    5032                             PHWND phwndClient)          // out: created client wnd
    5033 {
    5034     HWND hwndFrame;
    5035 
    5036     if (hwndFrame = winhCreateStdWindow(HWND_DESKTOP,
    5037                                         pData->pswpFrame,
    5038                                         pData->flFrameCreateFlags,
    5039                                         pData->ulFrameStyle,
    5040                                         pData->pcszFrameTitle,
    5041                                         pData->ulResourcesID,
    5042                                         pData->pcszClassClient,
    5043                                         pData->flStyleClient,
    5044                                         pData->ulID,
    5045                                         pData->pClientCtlData,
    5046                                         phwndClient))
    5047     {
    5048         if (pData->flExtFlags & XFCF_STATUSBAR)
    5049         {
    5050             // create status bar as child of the frame
    5051             HWND hwndStatusBar = winhCreateStatusBar(hwndFrame,
    5052                                                      hwndFrame,
    5053                                                      "",
    5054                                                      "9.WarpSans",
    5055                                                      CLR_BLACK);
    5056 
    5057             // subclass frame for supporting status bar and msgs
    5058             PEXTFRAMEDATA pFrameData;
    5059             if (pFrameData = NEW(EXTFRAMEDATA))
    5060             {
    5061                 ZERO(pFrameData),
    5062                 memcpy(&pFrameData->CData, pData, sizeof(pFrameData->CData));
    5063                 if (pFrameData->pfnwpOrig = WinSubclassWindow(hwndFrame,
    5064                                                               fnwpSubclExtFrame))
    5065                 {
    5066                     WinSetWindowPtr(hwndFrame, QWL_USER, pFrameData);
    5067                 }
    5068                 else
    5069                     free(pFrameData);
    5070             }
    5071         }
    5072     }
    5073 
    5074     return hwndFrame;
    5075 }
    5076 
    5077 /*
    50784868 *@@category: Helpers\PM helpers\Workplace Shell\WPS class list
    50794869 */
     
    51564946    while (pocThis)
    51574947    {
    5158         if (strcmp(pocThis->pszClassName, pszClass) == 0)
     4948        if (!strcmp(pocThis->pszClassName, pszClass))
    51594949        {
    51604950            pbReturn = (PBYTE)pocThis;
    51614951            break;
    51624952        }
     4953
    51634954        // next class
    51644955        pocThis = pocThis->pNext;
     
    52375028        // failed: do more error checking then, try DosLoadModule
    52385029        HMODULE hmod = NULLHANDLE;
    5239         arc = DosLoadModule(pszBuf, cbBuf,
    5240                             (PSZ)pcszModule,
    5241                             &hmod);
    5242         if (arc == NO_ERROR)
     5030        if (!(arc = DosLoadModule(pszBuf, cbBuf,
     5031                                  (PSZ)pcszModule,
     5032                                  &hmod)))
    52435033        {
    52445034            // DosLoadModule succeeded:
     
    52665056{
    52675057    BOOL    brc = FALSE;
    5268     PBYTE   pClassList = winhQueryWPSClassList();
    5269     if (pClassList)
     5058    PBYTE   pClassList;
     5059
     5060    if (pClassList = winhQueryWPSClassList())
    52705061    {
    52715062        if (winhQueryWPSClass(pClassList, pcszClass))
    52725063            brc = TRUE;
     5064
    52735065        free(pClassList);
    52745066    }
     
    53315123    return ulrc;
    53325124}
     5125
Note: See TracChangeset for help on using the changeset viewer.