# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1336851900 0 # Node ID 47e3223542932c7280757f86167b5f10e93128a2 # Parent 032c3388dda623cc89ffa6ba170c7ec8565c09ff Disabled experimental code on Windows for using toolbar controls instead of buttons to implement bitmap button widgets... allowing for borderless buttons. diff -r 032c3388dda6 -r 47e322354293 win/dw.c --- a/win/dw.c Tue May 08 18:53:03 2012 +0000 +++ b/win/dw.c Sat May 12 19:45:00 2012 +0000 @@ -6123,6 +6123,39 @@ HWND tmp; ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); HICON icon = LoadImage(DWInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, 0); +#ifdef GDIPLUS1 + HBITMAP hbitmap; + TBADDBITMAP tbBitmaps = {0}; + TBBUTTON tbButtons[] = { + { 0, id, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0} + }; + + /* Get the bitmap from either the icon or bitmap itself */ + if(!icon) + hbitmap = LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); + else + { + ICONINFO iconinfo; + + GetIconInfo(icon, &iconinfo); + hbitmap = iconinfo.hbmColor; + } + + /* Create the toolbar */ + tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | CCS_NORESIZE | CCS_NOPARENTALIGN, + 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); + + cinfo->fore = cinfo->back = -1; + + /* Insert the single bitmap and button into the toolbar */ + SendMessage(tmp, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + tbBitmaps.nID = (UINT_PTR)hbitmap; + SendMessage(tmp, TB_ADDBITMAP, 1, (LONG) &tbBitmaps); + SendMessage(tmp, TB_ADDBUTTONS, 1, (LONG) &tbButtons); + SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); + + _create_tooltip(tmp, text); +#else HBITMAP hbitmap = icon ? 0 : LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); tmp = CreateWindow(BUTTONCLASSNAME, @@ -6151,6 +6184,7 @@ { SendMessage(tmp, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) hbitmap); } +#endif return tmp; }