Ignore:
Timestamp:
Dec 14, 2001, 11:41:33 PM (24 years ago)
Author:
umoeller
Message:

Lots of changes for icons and refresh.

File:
1 edited

Legend:

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

    r122 r123  
    510510
    511511        case WM_MENUEND:
    512         {
    513512            if ((HWND)mp2 == pmbd->hwndMenu) // V0.9.14 (2001-07-31) [umoeller]
    514513            {
     
    548547                pmbd->hwndMenu = NULLHANDLE;
    549548            } // end if ((HWND)mp1 == pmbd->pmbd->hwndMenu) // V0.9.14 (2001-07-31) [umoeller]
    550         break; }
     549        break;
    551550
    552551        /*
     
    569568
    570569        case WM_DESTROY:
    571             mrc = (*(pmbd->pfnwpButtonOriginal))(hwndButton, msg, mp1, mp2);
     570            mrc = pmbd->pfnwpButtonOriginal(hwndButton, msg, mp1, mp2);
    572571            free(pmbd);
    573572        break;
    574573
    575574        default:
    576             mrc = (*(pmbd->pfnwpButtonOriginal))(hwndButton, msg, mp1, mp2);
     575            mrc = pmbd->pfnwpButtonOriginal(hwndButton, msg, mp1, mp2);
    577576    }
    578577
     
    617616{
    618617    BOOL brc = FALSE;
    619     PMENUBUTTONDATA pmbd = (PMENUBUTTONDATA)malloc(sizeof(MENUBUTTONDATA));
    620     if (pmbd)
     618    PMENUBUTTONDATA pmbd;
     619    if (pmbd = (PMENUBUTTONDATA)malloc(sizeof(MENUBUTTONDATA)))
    621620    {
    622621        memset(pmbd, 0, sizeof(MENUBUTTONDATA));
    623         pmbd->pfnwpButtonOriginal = WinSubclassWindow(hwndButton,
    624                                                       ctl_fnwpSubclassedMenuButton);
    625         if (pmbd->pfnwpButtonOriginal)
     622        if (pmbd->pfnwpButtonOriginal = WinSubclassWindow(hwndButton,
     623                                                          ctl_fnwpSubclassedMenuButton))
    626624        {
    627625            pmbd->hmodMenu = hmodMenu;
     
    730728
    731729            case WM_TIMER:
    732             {
    733730                pa->usAniCurrent++;
    734731                if (pa->usAniCurrent >= pa->usAniCount)
     
    739736                           (MPARAM)pa->ahptrAniIcons[pa->usAniCurrent],
    740737                           (MPARAM)NULL);
    741             break; }
     738            break;
    742739
    743740            /*
     
    793790                    // create a suitable bitmap w/ the size of the
    794791                    // static control
    795                     if ((pa->hbm = gpihCreateBitmap(hpsMem,
    796                                                     szlPage.cx,
    797                                                     szlPage.cy)))
     792                    if (    ((pa->hbm = gpihCreateBitmap(hpsMem,
     793                                                         szlPage.cx,
     794                                                         szlPage.cy)))
     795                            // associate the bit map with the memory PS
     796                         && (GpiSetBitmap(hpsMem, pa->hbm) != HBM_ERROR)
     797                       )
    798798                    {
    799                         // associate the bit map with the memory PS
    800                         if (GpiSetBitmap(hpsMem, pa->hbm) != HBM_ERROR)
     799                        // fill the bitmap with the current static
     800                        // background color
     801                        POINTL ptl = {0, 0};
     802                        GpiMove(hpsMem, &ptl);
     803                        ptl.x = pa->rclIcon.xRight;
     804                        ptl.y = pa->rclIcon.yTop;
     805                        GpiSetColor(hpsMem,
     806                                    lBkgndColor);
     807                        GpiBox(hpsMem,
     808                               DRO_FILL, // interior only
     809                               &ptl,
     810                               0, 0);    // no corner rounding
     811
     812                        /*
     813                         * ANF_ICON:
     814                         *
     815                         */
     816
     817                        if (pa->ulFlags & ANF_ICON)
    801818                        {
    802                             // fill the bitmap with the current static
    803                             // background color
    804                             POINTL ptl = {0, 0};
    805                             GpiMove(hpsMem, &ptl);
    806                             ptl.x = pa->rclIcon.xRight;
    807                             ptl.y = pa->rclIcon.yTop;
    808                             GpiSetColor(hpsMem,
    809                                         lBkgndColor);
    810                             GpiBox(hpsMem,
    811                                    DRO_FILL, // interior only
    812                                    &ptl,
    813                                    0, 0);    // no corner rounding
    814 
    815                             /*
    816                              * ANF_ICON:
    817                              *
    818                              */
    819 
    820                             if (pa->ulFlags & ANF_ICON)
     819                            // store new icon in our own structure
     820                            if (pa->hptr = (HPOINTER)mp1)
    821821                            {
    822                                 // store new icon in our own structure
    823                                 pa->hptr = (HPOINTER)mp1;
    824 
    825                                 if (pa->hptr)
    826                                 {
    827                                     // center the icon in the bitmap
    828                                     // V0.9.16 (2001-10-15) [umoeller]
    829                                     POINTL ptlOfs;
    830                                     ptlOfs.x = (   (pa->rclIcon.xRight - pa->rclIcon.xLeft)
    831                                                  - pa->lIconSize
    832                                                ) / 2;
    833                                     ptlOfs.y = (   (pa->rclIcon.yTop - pa->rclIcon.yBottom)
    834                                                  - pa->lIconSize
    835                                                ) / 2;
    836 
    837                                     // paint icon into bitmap
    838                                     gpihIcon2Bitmap(hpsMem,
    839                                                     pa->hptr,
    840                                                     lBkgndColor,
    841                                                     &ptlOfs,
    842                                                     pa->lIconSize);
    843                                 }
    844 
    845                             } // end if (pa->ulFlags & ANF_ICON)
    846 
    847                             /*
    848                              * ANF_BITMAP:
    849                              *
    850                              */
    851 
    852                             else if (pa->ulFlags & ANF_BITMAP)
    853                             {
    854                                 // store passed bitmap
    855                                 HBITMAP     hbmSource = (HBITMAP)mp1;
    856 
    857                                 if (hbmSource)
    858                                     gpihStretchBitmap(hpsMem,       // target
    859                                                       hbmSource,    // source
    860                                                       NULL,     // use size of bitmap
    861                                                       &pa->rclIcon,
    862                                                       ((pa->ulFlags & ANF_PROPORTIONAL)
    863                                                             != 0));
    864 
    865                             } // end if (pa->ulFlags & ANF_BITMAP)
    866 
    867                         } // end if (GpiSetBitmap(...
    868                     } // if (pa->hbm = gpihCreateBitmap(hpsMem, &(pa->rclIcon)))
     822                                // center the icon in the bitmap
     823                                // V0.9.16 (2001-10-15) [umoeller]
     824                                POINTL ptlOfs;
     825                                ptlOfs.x = (   (pa->rclIcon.xRight - pa->rclIcon.xLeft)
     826                                             - pa->lIconSize
     827                                           ) / 2;
     828                                ptlOfs.y = (   (pa->rclIcon.yTop - pa->rclIcon.yBottom)
     829                                             - pa->lIconSize
     830                                           ) / 2;
     831
     832                                // paint icon into bitmap
     833                                gpihIcon2Bitmap(hpsMem,
     834                                                pa->hptr,
     835                                                lBkgndColor,
     836                                                &ptlOfs,
     837                                                pa->lIconSize);
     838                            }
     839
     840                        } // end if (pa->ulFlags & ANF_ICON)
     841
     842                        /*
     843                         * ANF_BITMAP:
     844                         *
     845                         */
     846
     847                        else if (pa->ulFlags & ANF_BITMAP)
     848                        {
     849                            // store passed bitmap
     850                            HBITMAP     hbmSource;
     851                            if (hbmSource = (HBITMAP)mp1)
     852                                gpihStretchBitmap(hpsMem,       // target
     853                                                  hbmSource,    // source
     854                                                  NULL,     // use size of bitmap
     855                                                  &pa->rclIcon,
     856                                                  ((pa->ulFlags & ANF_PROPORTIONAL)
     857                                                        != 0));
     858
     859                        } // end if (pa->ulFlags & ANF_BITMAP)
     860
     861                    } // end if (GpiSetBitmap(...
     862                      // && (pa->hbm = gpihCreateBitmap(hpsMem, &(pa->rclIcon)))
    869863
    870864                    // in any case, clean up now
     
    877871                // enforce WM_PAINT
    878872                WinInvalidateRect(hwndStatic, NULL, FALSE);
    879 
    880             break; }
     873            }
     874            break;
    881875
    882876            /*
     
    940934
    941935                WinEndPaint(hps);
    942             break; }
     936            }
     937            break;
    943938
    944939            /*
     
    948943
    949944            case WM_DESTROY:
    950             {
    951945                // undo subclassing in case more WM_TIMERs come in
    952946                WinSubclassWindow(hwndStatic, OldStaticProc);
     
    962956
    963957                mrc = OldStaticProc(hwndStatic, msg, mp1, mp2);
    964             break; }
     958            break;
    965959
    966960            default:
     
    11171111                         BOOL fStartAnimation)       // TRUE: start animation now
    11181112{
    1119     PANIMATIONDATA paNew = ctlPrepareStaticIcon(hwndStatic, usAnimCount);
    1120     if (paNew)
     1113    PANIMATIONDATA paNew;
     1114    if (paNew = ctlPrepareStaticIcon(hwndStatic, usAnimCount))
    11211115    {
    11221116        paNew->ulDelay = ulDelay;
     
    11321126        if (fStartAnimation)
    11331127        {
    1134             WinStartTimer(WinQueryAnchorBlock(hwndStatic), hwndStatic,
    1135                     1, ulDelay);
    1136             WinPostMsg(hwndStatic, WM_TIMER, NULL, NULL);
     1128            WinStartTimer(paNew->hab,
     1129                          hwndStatic,
     1130                          1,
     1131                          ulDelay);
     1132            WinPostMsg(hwndStatic, WM_TIMER, (MPARAM)1, NULL);
    11371133        }
    11381134    }
     
    11501146{
    11511147    BOOL brc = FALSE;
    1152     PANIMATIONDATA pa = (PANIMATIONDATA)WinQueryWindowULong(hwndStatic, QWL_USER);
    1153     if (pa)
    1154         if (WinStartTimer(WinQueryAnchorBlock(hwndStatic), hwndStatic,
    1155                         1, pa->ulDelay))
    1156         {
    1157             brc = TRUE;
    1158             WinPostMsg(hwndStatic, WM_TIMER, NULL, NULL);
    1159         }
     1148    PANIMATIONDATA pa;
     1149    if (    (pa = (PANIMATIONDATA)WinQueryWindowULong(hwndStatic, QWL_USER))
     1150         && (WinStartTimer(pa->hab,
     1151                           hwndStatic,
     1152                           1,
     1153                           pa->ulDelay))
     1154       )
     1155    {
     1156        brc = TRUE;
     1157        WinPostMsg(hwndStatic, WM_TIMER, (MPARAM)1, NULL);
     1158    }
     1159
    11601160    return (brc);
    11611161}
     
    13451345                    // check flags:
    13461346                    // filter out those ugly composite key (accents etc.)
    1347                &&  ((usFlags & (KC_DEADKEY | KC_COMPOSITE | KC_INVALIDCOMP)) == 0)
     1347                 && ((usFlags & (KC_DEADKEY | KC_COMPOSITE | KC_INVALIDCOMP)) == 0)
    13481348               )
    13491349            {
     
    13671367
    13681368                flReturned = (ULONG)WinSendMsg(hwndOwner,
    1369                                           WM_CONTROL,
    1370                                           MPFROM2SHORT(WinQueryWindowUShort(hwndEdit,
    1371                                                                             QWS_ID),
    1372                                                        EN_HOTKEY),  // new notification code
    1373                                           (MPARAM)&hkn);
     1369                                               WM_CONTROL,
     1370                                               MPFROM2SHORT(WinQueryWindowUShort(hwndEdit,
     1371                                                                                 QWS_ID),
     1372                                                            EN_HOTKEY),  // new notification code
     1373                                               (MPARAM)&hkn);
    13741374                if (flReturned & HEFL_SETTEXT)
    13751375                    WinSetWindowText(hwndEdit, hkn.szDescription);
     
    13831383                    WinSetWindowText(hwndEdit, "");
    13841384
    1385 
    13861385                mrc = (MPARAM)TRUE; // WM_CHAR processed flag;
    13871386            }
    1388         break; }
     1387        }
     1388        break;
    13891389
    13901390        default:
Note: See TracChangeset for help on using the changeset viewer.