Changeset 123 for trunk/src/helpers/comctl.c
- Timestamp:
- Dec 14, 2001, 11:41:33 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/comctl.c
r122 r123 510 510 511 511 case WM_MENUEND: 512 {513 512 if ((HWND)mp2 == pmbd->hwndMenu) // V0.9.14 (2001-07-31) [umoeller] 514 513 { … … 548 547 pmbd->hwndMenu = NULLHANDLE; 549 548 } // end if ((HWND)mp1 == pmbd->pmbd->hwndMenu) // V0.9.14 (2001-07-31) [umoeller] 550 break; }549 break; 551 550 552 551 /* … … 569 568 570 569 case WM_DESTROY: 571 mrc = (*(pmbd->pfnwpButtonOriginal))(hwndButton, msg, mp1, mp2);570 mrc = pmbd->pfnwpButtonOriginal(hwndButton, msg, mp1, mp2); 572 571 free(pmbd); 573 572 break; 574 573 575 574 default: 576 mrc = (*(pmbd->pfnwpButtonOriginal))(hwndButton, msg, mp1, mp2);575 mrc = pmbd->pfnwpButtonOriginal(hwndButton, msg, mp1, mp2); 577 576 } 578 577 … … 617 616 { 618 617 BOOL brc = FALSE; 619 PMENUBUTTONDATA pmbd = (PMENUBUTTONDATA)malloc(sizeof(MENUBUTTONDATA));620 if (pmbd )618 PMENUBUTTONDATA pmbd; 619 if (pmbd = (PMENUBUTTONDATA)malloc(sizeof(MENUBUTTONDATA))) 621 620 { 622 621 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)) 626 624 { 627 625 pmbd->hmodMenu = hmodMenu; … … 730 728 731 729 case WM_TIMER: 732 {733 730 pa->usAniCurrent++; 734 731 if (pa->usAniCurrent >= pa->usAniCount) … … 739 736 (MPARAM)pa->ahptrAniIcons[pa->usAniCurrent], 740 737 (MPARAM)NULL); 741 break; }738 break; 742 739 743 740 /* … … 793 790 // create a suitable bitmap w/ the size of the 794 791 // 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 ) 798 798 { 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) 801 818 { 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) 821 821 { 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))) 869 863 870 864 // in any case, clean up now … … 877 871 // enforce WM_PAINT 878 872 WinInvalidateRect(hwndStatic, NULL, FALSE); 879 880 break; }873 } 874 break; 881 875 882 876 /* … … 940 934 941 935 WinEndPaint(hps); 942 break; } 936 } 937 break; 943 938 944 939 /* … … 948 943 949 944 case WM_DESTROY: 950 {951 945 // undo subclassing in case more WM_TIMERs come in 952 946 WinSubclassWindow(hwndStatic, OldStaticProc); … … 962 956 963 957 mrc = OldStaticProc(hwndStatic, msg, mp1, mp2); 964 break; }958 break; 965 959 966 960 default: … … 1117 1111 BOOL fStartAnimation) // TRUE: start animation now 1118 1112 { 1119 PANIMATIONDATA paNew = ctlPrepareStaticIcon(hwndStatic, usAnimCount);1120 if (paNew )1113 PANIMATIONDATA paNew; 1114 if (paNew = ctlPrepareStaticIcon(hwndStatic, usAnimCount)) 1121 1115 { 1122 1116 paNew->ulDelay = ulDelay; … … 1132 1126 if (fStartAnimation) 1133 1127 { 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); 1137 1133 } 1138 1134 } … … 1150 1146 { 1151 1147 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 1160 1160 return (brc); 1161 1161 } … … 1345 1345 // check flags: 1346 1346 // 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) 1348 1348 ) 1349 1349 { … … 1367 1367 1368 1368 flReturned = (ULONG)WinSendMsg(hwndOwner, 1369 WM_CONTROL,1370 MPFROM2SHORT(WinQueryWindowUShort(hwndEdit,1371 QWS_ID),1372 EN_HOTKEY), // new notification code1373 (MPARAM)&hkn);1369 WM_CONTROL, 1370 MPFROM2SHORT(WinQueryWindowUShort(hwndEdit, 1371 QWS_ID), 1372 EN_HOTKEY), // new notification code 1373 (MPARAM)&hkn); 1374 1374 if (flReturned & HEFL_SETTEXT) 1375 1375 WinSetWindowText(hwndEdit, hkn.szDescription); … … 1383 1383 WinSetWindowText(hwndEdit, ""); 1384 1384 1385 1386 1385 mrc = (MPARAM)TRUE; // WM_CHAR processed flag; 1387 1386 } 1388 break; } 1387 } 1388 break; 1389 1389 1390 1390 default:
Note:
See TracChangeset
for help on using the changeset viewer.