Changeset 45
- Timestamp:
- 03/04/08 12:51:16 (6 months ago)
- Files:
-
- trunk/win32/dfl/application.d (modified) (1 diff)
- trunk/win32/dfl/imagelist.d (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/win32/dfl/application.d
r42 r45 238 238 activateActCtx(hac, &ul); 239 239 240 _initCommonControls(ICC_STANDARD_CLASSES); 240 _initCommonControls(ICC_STANDARD_CLASSES); // Yes. 241 //InitCommonControls(); // No. Doesn't work with common controls version 6! 241 242 242 /+ // Not helping. 243 // Fix issue with image lists now showing... 244 PostMessageA(null, wmDfl, 0, 0); // Posts to this thread. 245 //Application.doEvents(); 243 // Ensure the actctx is actually associated with the message queue... 244 PostMessageA(null, wmDfl, 0, 0); 246 245 { 247 246 MSG msg; 248 GetMessageA(&msg, null, wmDfl, wmDfl);247 PeekMessageA(&msg, null, wmDfl, wmDfl, PM_REMOVE); 249 248 } 250 +/251 249 } 252 250 else trunk/win32/dfl/imagelist.d
r44 r45 67 67 68 68 69 import std.string: format; 70 import dfl.messagebox : msgBox; 69 71 void _added(size_t idx, Image val) 70 72 { 71 73 if(isHandleCreated) 72 74 { 73 if(idx >= _images.length) 75 //if(idx >= _images.length) // Can't test for this here because -val- is already added to the array. 76 _addimg(val); 77 } 78 } 79 80 81 void _removed(size_t idx, Image val) 82 { 83 if(isHandleCreated) 84 { 85 if(size_t.max == idx) // Clear all. 74 86 { 75 _addimg(val);87 imageListRemove(handle, -1); 76 88 } 77 89 else 78 90 { 79 assert(0); 80 } 81 } 82 } 83 84 85 void _removed(size_t idx, Image val) 86 { 87 if(isHandleCreated) 88 { 89 if(size_t.max == idx) // Clear all. 90 { 91 ImageList_Remove(handle, -1); 92 } 93 else 94 { 95 ImageList_Remove(handle, idx); 91 imageListRemove(handle, idx); 96 92 } 97 93 } … … 110 106 this() 111 107 { 108 InitCommonControls(); 109 112 110 _cimages = new ImageCollection(); 113 111 _transcolor = Color.transparent; … … 181 179 182 180 181 /+ // Actually, forget about these; just draw with the actual images. 183 182 /// 184 183 final void draw(Graphics g, Point pt, int index) … … 190 189 final void draw(Graphics g, int x, int y, int index) 191 190 { 192 ImageList_Draw(handle, index, g.handle, x, y, ILD_NORMAL);191 imageListDraw(handle, index, g.handle, x, y, ILD_NORMAL); 193 192 } 194 193 … … 204 203 return; 205 204 206 ImageList_DrawEx(handle, index, g.handle, x, y, width, height,205 imageListDrawEx(handle, index, g.handle, x, y, width, height, 207 206 CLR_NONE, CLR_NONE, ILD_NORMAL); // ? 208 207 } 208 +/ 209 209 210 210 … … 237 237 { 238 238 if(isHandleCreated) 239 ImageList_Destroy(_hil);239 imageListDestroy(_hil); 240 240 _hil = HIMAGELIST.init; 241 241 … … 268 268 if(isHandleCreated) 269 269 { 270 ImageList_Destroy(_hil);270 imageListDestroy(_hil); 271 271 _hil = HIMAGELIST.init; 272 272 } … … 283 283 284 284 // Note: cGrow is not a limit, but how many images to preallocate each grow. 285 _hil = ImageList_Create(_w, _h, flags, _cimages._images.length, 4 + _cimages._images.length / 4);285 _hil = imageListCreate(_w, _h, flags, _cimages._images.length, 4 + _cimages._images.length / 4); 286 286 if(!_hil) 287 287 throw new Exception("Unable to create image list"); … … 320 320 cr = _transcolor.toRgb(); 321 321 } 322 result = ImageList_AddMasked(_hil, cast(HBITMAP)hgo, cr);322 result = imageListAddMasked(_hil, cast(HBITMAP)hgo, cr); 323 323 } 324 324 break; 325 325 326 326 case 2: 327 result = ImageList_AddIcon(_hil, cast(HICON)hgo);327 result = imageListAddIcon(_hil, cast(HICON)hgo); 328 328 break; 329 329 … … 337 337 } 338 338 339 340 private extern(Windows) 341 { 342 // This was the only way I could figure out how to use the current actctx (Windows issue). 343 344 HIMAGELIST imageListCreate( 345 int cx, int cy, UINT flags, int cInitial, int cGrow) 346 { 347 alias typeof(&ImageList_Create) TProc; 348 static TProc proc = null; 349 if(!proc) 350 proc = cast(typeof(proc))GetProcAddress(GetModuleHandleA("comctl32.dll"), "ImageList_Create"); 351 return proc(cx, cy, flags, cInitial, cGrow); 352 } 353 354 int imageListAddIcon( 355 HIMAGELIST himl, HICON hicon) 356 { 357 alias typeof(&ImageList_AddIcon) TProc; 358 static TProc proc = null; 359 if(!proc) 360 proc = cast(typeof(proc))GetProcAddress(GetModuleHandleA("comctl32.dll"), "ImageList_AddIcon"); 361 return proc(himl, hicon); 362 } 363 364 int imageListAddMasked( 365 HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask) 366 { 367 alias typeof(&ImageList_AddMasked) TProc; 368 static TProc proc = null; 369 if(!proc) 370 proc = cast(typeof(proc))GetProcAddress(GetModuleHandleA("comctl32.dll"), "ImageList_AddMasked"); 371 return proc(himl, hbmImage, crMask); 372 } 373 374 BOOL imageListRemove( 375 HIMAGELIST himl, int i) 376 { 377 alias typeof(&ImageList_Remove) TProc; 378 static TProc proc = null; 379 if(!proc) 380 proc = cast(typeof(proc))GetProcAddress(GetModuleHandleA("comctl32.dll"), "ImageList_Remove"); 381 return proc(himl, i); 382 } 383 384 BOOL imageListDestroy( 385 HIMAGELIST himl) 386 { 387 alias typeof(&ImageList_Destroy) TProc; 388 static TProc proc = null; 389 if(!proc) 390 proc = cast(typeof(proc))GetProcAddress(GetModuleHandleA("comctl32.dll"), "ImageList_Destroy"); 391 return proc(himl); 392 } 393 } 394
