Mercurial > dwindows
comparison win/dw.c @ 1720:47e322354293
Disabled experimental code on Windows for using toolbar controls instead of
buttons to implement bitmap button widgets... allowing for borderless buttons.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 12 May 2012 19:45:00 +0000 |
parents | 8228b3cf8f37 |
children | 8c98c8525918 |
comparison
equal
deleted
inserted
replaced
1719:032c3388dda6 | 1720:47e322354293 |
---|---|
6121 HWND API dw_bitmapbutton_new(char *text, ULONG id) | 6121 HWND API dw_bitmapbutton_new(char *text, ULONG id) |
6122 { | 6122 { |
6123 HWND tmp; | 6123 HWND tmp; |
6124 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); | 6124 ColorInfo *cinfo = calloc(1, sizeof(ColorInfo)); |
6125 HICON icon = LoadImage(DWInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, 0); | 6125 HICON icon = LoadImage(DWInstance, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, 0); |
6126 #ifdef GDIPLUS1 | |
6127 HBITMAP hbitmap; | |
6128 TBADDBITMAP tbBitmaps = {0}; | |
6129 TBBUTTON tbButtons[] = { | |
6130 { 0, id, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0} | |
6131 }; | |
6132 | |
6133 /* Get the bitmap from either the icon or bitmap itself */ | |
6134 if(!icon) | |
6135 hbitmap = LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); | |
6136 else | |
6137 { | |
6138 ICONINFO iconinfo; | |
6139 | |
6140 GetIconInfo(icon, &iconinfo); | |
6141 hbitmap = iconinfo.hbmColor; | |
6142 } | |
6143 | |
6144 /* Create the toolbar */ | |
6145 tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | CCS_NORESIZE | CCS_NOPARENTALIGN, | |
6146 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); | |
6147 | |
6148 cinfo->fore = cinfo->back = -1; | |
6149 | |
6150 /* Insert the single bitmap and button into the toolbar */ | |
6151 SendMessage(tmp, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); | |
6152 tbBitmaps.nID = (UINT_PTR)hbitmap; | |
6153 SendMessage(tmp, TB_ADDBITMAP, 1, (LONG) &tbBitmaps); | |
6154 SendMessage(tmp, TB_ADDBUTTONS, 1, (LONG) &tbButtons); | |
6155 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); | |
6156 | |
6157 _create_tooltip(tmp, text); | |
6158 #else | |
6126 HBITMAP hbitmap = icon ? 0 : LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); | 6159 HBITMAP hbitmap = icon ? 0 : LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); |
6127 | 6160 |
6128 tmp = CreateWindow(BUTTONCLASSNAME, | 6161 tmp = CreateWindow(BUTTONCLASSNAME, |
6129 NULL, | 6162 NULL, |
6130 WS_CHILD | BS_PUSHBUTTON | | 6163 WS_CHILD | BS_PUSHBUTTON | |
6149 } | 6182 } |
6150 else if(hbitmap) | 6183 else if(hbitmap) |
6151 { | 6184 { |
6152 SendMessage(tmp, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) hbitmap); | 6185 SendMessage(tmp, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) hbitmap); |
6153 } | 6186 } |
6187 #endif | |
6154 return tmp; | 6188 return tmp; |
6155 } | 6189 } |
6156 | 6190 |
6157 /* | 6191 /* |
6158 * Create a new bitmap button window (widget) to be packed from a file. | 6192 * Create a new bitmap button window (widget) to be packed from a file. |