comparison win/dw.c @ 552:d940dc1ff462

Initial code to support icons in dw_bitmapbutton_new() but it doesn't seem to like my 20x20 icons. :(
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 11 Apr 2004 05:58:43 +0000
parents 536b32eb0cb0
children 0d47bec8a5fb
comparison
equal deleted inserted replaced
551:756477206006 552:d940dc1ff462
4499 HWND API dw_bitmapbutton_new(char *text, ULONG id) 4499 HWND API dw_bitmapbutton_new(char *text, ULONG id)
4500 { 4500 {
4501 HWND tmp; 4501 HWND tmp;
4502 BubbleButton *bubble = calloc(1, sizeof(BubbleButton)); 4502 BubbleButton *bubble = calloc(1, sizeof(BubbleButton));
4503 HBITMAP hbitmap = LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); 4503 HBITMAP hbitmap = LoadBitmap(DWInstance, MAKEINTRESOURCE(id));
4504 HICON icon = LoadIcon(DWInstance, MAKEINTRESOURCE(id));
4504 4505
4505 tmp = CreateWindow(BUTTONCLASSNAME, 4506 tmp = CreateWindow(BUTTONCLASSNAME,
4506 "", 4507 "",
4507 WS_CHILD | BS_PUSHBUTTON | 4508 WS_CHILD | BS_PUSHBUTTON |
4508 BS_BITMAP | WS_CLIPCHILDREN | 4509 BS_BITMAP | WS_CLIPCHILDREN |
4518 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; 4519 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
4519 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc); 4520 bubble->pOldProc = (WNDPROC)SubclassWindow(tmp, _BtProc);
4520 4521
4521 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)bubble); 4522 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)bubble);
4522 4523
4523 SendMessage(tmp, BM_SETIMAGE, 4524 if(icon)
4524 (WPARAM) IMAGE_BITMAP, 4525 {
4525 (LPARAM) hbitmap); 4526 SendMessage(tmp, BM_SETIMAGE,
4527 (WPARAM) IMAGE_ICON,
4528 (LPARAM) icon);
4529 }
4530 else if(hbitmap)
4531 {
4532 SendMessage(tmp, BM_SETIMAGE,
4533 (WPARAM) IMAGE_BITMAP,
4534 (LPARAM) hbitmap);
4535 }
4526 return tmp; 4536 return tmp;
4527 } 4537 }
4528 4538
4529 /* 4539 /*
4530 * Create a new bitmap button window (widget) to be packed from a file. 4540 * Create a new bitmap button window (widget) to be packed from a file.