Mercurial > dwindows
comparison os2/dw.c @ 129:e47c52b37cdd
Code cleanup and OS/2 and Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 20 Oct 2002 06:36:18 +0000 |
parents | ac616f625443 |
children | 2584a4646b41 |
comparison
equal
deleted
inserted
replaced
128:ac616f625443 | 129:e47c52b37cdd |
---|---|
833 | 833 |
834 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); | 834 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); |
835 | 835 |
836 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); | 836 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); |
837 } | 837 } |
838 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR)); | 838 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, (MPARAM)page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR)); |
839 } | 839 } |
840 | 840 |
841 } | 841 } |
842 } | 842 } |
843 | 843 |
1444 _run_event(hWnd, msg, mp1, mp2); | 1444 _run_event(hWnd, msg, mp1, mp2); |
1445 break; | 1445 break; |
1446 case WM_CHAR: | 1446 case WM_CHAR: |
1447 /* A Similar problem to the MLE, if ESC just return */ | 1447 /* A Similar problem to the MLE, if ESC just return */ |
1448 if(SHORT1FROMMP(mp2) == 283) | 1448 if(SHORT1FROMMP(mp2) == 283) |
1449 return TRUE; | 1449 return (MRESULT)TRUE; |
1450 break; | 1450 break; |
1451 } | 1451 } |
1452 | 1452 |
1453 if(blah && blah->oldproc) | 1453 if(blah && blah->oldproc) |
1454 return blah->oldproc(hWnd, msg, mp1, mp2); | 1454 return blah->oldproc(hWnd, msg, mp1, mp2); |
1507 _click_default(blah->clickdefault); | 1507 _click_default(blah->clickdefault); |
1508 /* When you hit escape we get this value and the | 1508 /* When you hit escape we get this value and the |
1509 * window hangs for reasons unknown. (in an MLE) | 1509 * window hangs for reasons unknown. (in an MLE) |
1510 */ | 1510 */ |
1511 else if(SHORT1FROMMP(mp2) == 283) | 1511 else if(SHORT1FROMMP(mp2) == 283) |
1512 return TRUE; | 1512 return (MRESULT)TRUE; |
1513 | 1513 |
1514 break; | 1514 break; |
1515 case WM_SIZE: | 1515 case WM_SIZE: |
1516 { | 1516 { |
1517 char tmpbuf[100]; | 1517 char tmpbuf[100]; |
2285 | 2285 |
2286 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) | 2286 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) |
2287 { | 2287 { |
2288 if(type == BOXHORZ) | 2288 if(type == BOXHORZ) |
2289 { | 2289 { |
2290 int newx = x - SPLITBAR_WIDTH, newy = y; | 2290 int newx = x - SPLITBAR_WIDTH; |
2291 float ratio = (float)percent/(float)100.0; | 2291 float ratio = (float)percent/(float)100.0; |
2292 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 2292 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
2293 Box *tmp = WinQueryWindowPtr(handle, QWP_USER); | 2293 Box *tmp = WinQueryWindowPtr(handle, QWP_USER); |
2294 | 2294 |
2295 newx = (int)((float)newx * ratio); | 2295 newx = (int)((float)newx * ratio); |
2307 WinSetWindowPos(handle, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE | SWP_SHOW); | 2307 WinSetWindowPos(handle, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE | SWP_SHOW); |
2308 _do_resize(tmp, newx, y); | 2308 _do_resize(tmp, newx, y); |
2309 } | 2309 } |
2310 else | 2310 else |
2311 { | 2311 { |
2312 int newx = x, newy = y - SPLITBAR_WIDTH; | 2312 int newy = y - SPLITBAR_WIDTH; |
2313 float ratio = (float)percent/(float)100.0; | 2313 float ratio = (float)percent/(float)100.0; |
2314 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 2314 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
2315 Box *tmp = WinQueryWindowPtr(handle, QWP_USER); | 2315 Box *tmp = WinQueryWindowPtr(handle, QWP_USER); |
2316 | 2316 |
2317 newy = (int)((float)newy * ratio); | 2317 newy = (int)((float)newy * ratio); |
2727 if(blah) | 2727 if(blah) |
2728 oldproc = blah->oldproc; | 2728 oldproc = blah->oldproc; |
2729 | 2729 |
2730 switch(msg) | 2730 switch(msg) |
2731 { | 2731 { |
2732 #if 0 /* Why doesn't this work? */ | |
2733 case WM_PAINT: | 2732 case WM_PAINT: |
2734 { | 2733 { |
2735 HPS hps; | 2734 HPS hps; |
2736 RECTL rcl; | 2735 RECTL rcl; |
2737 POINTL ptl[2]; | 2736 POINTL ptl[2]; |
2738 | 2737 |
2739 if(oldproc) | 2738 if(oldproc) |
2740 return oldproc(hwnd, msg, mp1, mp2); | 2739 oldproc(hwnd, msg, mp1, mp2); |
2741 | 2740 |
2742 hps = WinBeginPaint(hwnd, 0, 0); | 2741 hps = WinBeginPaint(hwnd, 0, 0); |
2743 WinQueryWindowRect(hwnd, &rcl); | 2742 WinQueryWindowRect(hwnd, &rcl); |
2744 ptl[0].x = rcl.xLeft + 1; | 2743 ptl[0].x = rcl.xLeft + 1; |
2745 ptl[0].y = rcl.yBottom + 1; | 2744 ptl[0].y = rcl.yBottom + 1; |
2750 GpiMove(hps, &ptl[0]); | 2749 GpiMove(hps, &ptl[0]); |
2751 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0); | 2750 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0); |
2752 WinEndPaint(hps); | 2751 WinEndPaint(hps); |
2753 } | 2752 } |
2754 return MRFROMSHORT(FALSE); | 2753 return MRFROMSHORT(FALSE); |
2755 #endif | |
2756 case WM_SETFOCUS: | 2754 case WM_SETFOCUS: |
2757 _run_event(hwnd, msg, mp1, mp2); | 2755 _run_event(hwnd, msg, mp1, mp2); |
2758 break; | 2756 break; |
2759 case WM_CHAR: | 2757 case WM_CHAR: |
2760 if(SHORT1FROMMP(mp2) == '\t') | 2758 if(SHORT1FROMMP(mp2) == '\t') |
6620 * Parameters: | 6618 * Parameters: |
6621 * handle: The handle to the splitbar returned by dw_splitbar_new(). | 6619 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
6622 */ | 6620 */ |
6623 void dw_splitbar_set(HWND handle, float percent) | 6621 void dw_splitbar_set(HWND handle, float percent) |
6624 { | 6622 { |
6625 /* We probably need to force a redraw here */ | |
6626 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); | 6623 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); |
6627 int type = (int)dw_window_get_data(handle, "_dw_type"); | 6624 int type = (int)dw_window_get_data(handle, "_dw_type"); |
6628 int width, height; | 6625 unsigned long width, height; |
6629 | 6626 |
6630 if(mypercent) | 6627 if(mypercent) |
6631 *mypercent = percent; | 6628 *mypercent = percent; |
6632 | 6629 |
6633 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); | 6630 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); |