comparison win/dw.c @ 299:2a97f8d9b297

Use DrawStatusText() to make the status lines, instead of doing it ourself.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 27 Mar 2003 08:54:48 +0000
parents caed245ea8a1
children 887675ee5b67
comparison
equal deleted inserted replaced
298:caed245ea8a1 299:2a97f8d9b297
60 60
61 61
62 void _resize_notebook_page(HWND handle, int pageid); 62 void _resize_notebook_page(HWND handle, int pageid);
63 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); 63 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
64 int _lookup_icon(HWND handle, HICON hicon, int type); 64 int _lookup_icon(HWND handle, HICON hicon, int type);
65 HFONT _acquire_font(HWND handle, char *fontname);
65 66
66 typedef struct _sighandler 67 typedef struct _sighandler
67 { 68 {
68 struct _sighandler *next; 69 struct _sighandler *next;
69 ULONG message; 70 ULONG message;
2629 case WM_PAINT: 2630 case WM_PAINT:
2630 { 2631 {
2631 HDC hdcPaint; 2632 HDC hdcPaint;
2632 PAINTSTRUCT ps; 2633 PAINTSTRUCT ps;
2633 RECT rc; 2634 RECT rc;
2634 HFONT hFont;
2635 HBRUSH oldBrush;
2636 HPEN oldPen;
2637 unsigned long cx, cy; 2635 unsigned long cx, cy;
2638 int threadid = dw_thread_id(); 2636 int threadid = dw_thread_id();
2639 char tempbuf[1024] = ""; 2637 char tempbuf[1024] = "";
2640 2638 ColorInfo *cinfo = (ColorInfo *)GetWindowLong(hwnd, GWL_USERDATA);
2641 if(threadid < 0 || threadid >= THREAD_LIMIT) 2639 HFONT hfont = _acquire_font(hwnd, cinfo ? cinfo->fontname : NULL);
2642 threadid = 0; 2640 HFONT oldfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
2641
2642 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy);
2643 GetWindowText(hwnd, tempbuf, 1024);
2643 2644
2644 hdcPaint = BeginPaint(hwnd, &ps); 2645 hdcPaint = BeginPaint(hwnd, &ps);
2646 if(hfont)
2647 oldfont = (HFONT)SelectObject(hdcPaint, hfont);
2648 rc.top = rc.left = 0;
2649 rc.right = cx;
2650 rc.bottom = cy;
2651 DrawStatusText(hdcPaint, &rc, tempbuf, 0);
2652 if(hfont && oldfont)
2653 SelectObject(hdcPaint, oldfont);
2654 if(hfont)
2655 DeleteObject(hfont);
2645 EndPaint(hwnd, &ps); 2656 EndPaint(hwnd, &ps);
2646
2647 hdcPaint = GetDC(hwnd);
2648
2649 oldBrush = _hBrush[threadid];
2650 oldPen = _hPen[threadid];
2651
2652 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy);
2653
2654
2655 _hBrush[threadid] = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
2656
2657 dw_draw_rect(hwnd, 0, TRUE, 0, 0, cx, cy);
2658
2659 _hPen[threadid] = CreatePen(PS_SOLID, 1, RGB(_red[DW_CLR_DARKGRAY],
2660 _green[DW_CLR_DARKGRAY],
2661 _blue[DW_CLR_DARKGRAY]));
2662
2663 dw_draw_line(hwnd, 0, 0, 0, cx, 0);
2664 dw_draw_line(hwnd, 0, 0, 0, 0, cy);
2665
2666 DeleteObject(_hPen[threadid]);
2667
2668 _hPen[threadid] = GetStockObject(WHITE_PEN);
2669
2670 dw_draw_line(hwnd, 0, cx - 1, cy - 1, cx - 1, 0);
2671 dw_draw_line(hwnd, 0, cx - 1, cy - 1, 0, cy - 1);
2672
2673 rc.left = 3;
2674 rc.top = 1;
2675 rc.bottom = cy - 1;
2676 rc.right = cx - 1;
2677
2678 GetWindowText(hwnd, tempbuf, 1024);
2679
2680 hFont = (HFONT)SelectObject(hdcPaint, GetStockObject(DEFAULT_GUI_FONT));
2681
2682 SetTextColor(hdcPaint, RGB(0,0,0));
2683 SetBkMode(hdcPaint, TRANSPARENT);
2684
2685 ExtTextOut(hdcPaint, 3, 1, ETO_CLIPPED, &rc, tempbuf, strlen(tempbuf), NULL);
2686
2687 SelectObject(hdcPaint, hFont);
2688
2689 DeleteObject(_hBrush[threadid]);
2690 _hBrush[threadid] = oldBrush;
2691 _hPen[threadid] = oldPen;
2692 ReleaseDC(hwnd, hdcPaint);
2693 } 2657 }
2694 return FALSE; 2658 return FALSE;
2695 } 2659 }
2696 return DefWindowProc(hwnd, msg, mp1, mp2); 2660 return DefWindowProc(hwnd, msg, mp1, mp2);
2697 } 2661 }
4003 * text: The text to be display by the static text widget. 3967 * text: The text to be display by the static text widget.
4004 * id: An ID to be used with dw_window_from_id() or 0L. 3968 * id: An ID to be used with dw_window_from_id() or 0L.
4005 */ 3969 */
4006 HWND API dw_status_text_new(char *text, ULONG id) 3970 HWND API dw_status_text_new(char *text, ULONG id)
4007 { 3971 {
4008 HWND tmp = CreateWindow(STATICCLASSNAME, 3972 HWND tmp = CreateWindow(ObjectClassName,
4009 text, 3973 text,
4010 BS_TEXT | WS_VISIBLE | 3974 BS_TEXT | WS_VISIBLE |
4011 WS_CHILD | WS_CLIPCHILDREN, 3975 WS_CHILD | WS_CLIPCHILDREN,
4012 0,0,2000,1000, 3976 0,0,2000,1000,
4013 DW_HWND_OBJECT, 3977 DW_HWND_OBJECT,