Mercurial > dwindows
comparison mac/dw.m @ 1943:469711814566
Mac: Fix NSStatusItem deprecation warnings by using the embedded NSStatusBarButton instead.
Also moved code into YOSEMITE #ifdef since it is only supported on 10.10 and later.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 22 Jun 2019 20:11:52 +0000 |
parents | 5658f703a22e |
children | d37f30a7c233 |
comparison
equal
deleted
inserted
replaced
1942:5658f703a22e | 1943:469711814566 |
---|---|
7415 * icon: Icon handle to display in the taskbar. | 7415 * icon: Icon handle to display in the taskbar. |
7416 * bubbletext: Text to show when the mouse is above the icon. | 7416 * bubbletext: Text to show when the mouse is above the icon. |
7417 */ | 7417 */ |
7418 void API dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) | 7418 void API dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) |
7419 { | 7419 { |
7420 #ifdef BUILDING_FOR_YOSEMITE | |
7420 NSStatusItem *item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; | 7421 NSStatusItem *item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; |
7422 NSStatusBarButton *button = [item button]; | |
7421 NSImage *image = icon; | 7423 NSImage *image = icon; |
7422 [item setImage:image]; | 7424 [button setImage:image]; |
7423 if(bubbletext) | 7425 if(bubbletext) |
7424 [item setToolTip:[NSString stringWithUTF8String:bubbletext]]; | 7426 [button setToolTip:[NSString stringWithUTF8String:bubbletext]]; |
7425 [item setTarget:handle]; | 7427 [button setTarget:handle]; |
7426 [item setEnabled:YES]; | 7428 [button setEnabled:YES]; |
7427 [item setHighlightMode:YES]; | 7429 [[button cell] setHighlighted:YES]; |
7428 [item sendActionOn:(DWEventMaskLeftMouseUp|DWEventMaskLeftMouseDown|DWEventMaskRightMouseUp|DWEventMaskRightMouseDown)]; | 7430 [button sendActionOn:(DWEventMaskLeftMouseUp|DWEventMaskLeftMouseDown|DWEventMaskRightMouseUp|DWEventMaskRightMouseDown)]; |
7429 [item setAction:@selector(mouseDown:)]; | 7431 [button setAction:@selector(mouseDown:)]; |
7430 dw_window_set_data(handle, "_dw_taskbar", item); | 7432 dw_window_set_data(handle, "_dw_taskbar", item); |
7433 #endif | |
7431 } | 7434 } |
7432 | 7435 |
7433 /* | 7436 /* |
7434 * Deletes an icon from the taskbar. | 7437 * Deletes an icon from the taskbar. |
7435 * Parameters: | 7438 * Parameters: |
7436 * handle: Window handle that was used with dw_taskbar_insert(). | 7439 * handle: Window handle that was used with dw_taskbar_insert(). |
7437 * icon: Icon handle that was used with dw_taskbar_insert(). | 7440 * icon: Icon handle that was used with dw_taskbar_insert(). |
7438 */ | 7441 */ |
7439 void API dw_taskbar_delete(HWND handle, HICN icon) | 7442 void API dw_taskbar_delete(HWND handle, HICN icon) |
7440 { | 7443 { |
7444 #ifdef BUILDING_FOR_YOSEMITE | |
7441 NSStatusItem *item = dw_window_get_data(handle, "_dw_taskbar"); | 7445 NSStatusItem *item = dw_window_get_data(handle, "_dw_taskbar"); |
7442 DW_LOCAL_POOL_IN; | 7446 DW_LOCAL_POOL_IN; |
7443 [item release]; | 7447 [item release]; |
7444 DW_LOCAL_POOL_OUT; | 7448 DW_LOCAL_POOL_OUT; |
7449 #endif | |
7445 } | 7450 } |
7446 | 7451 |
7447 /* Internal function to keep HICNs from getting too big */ | 7452 /* Internal function to keep HICNs from getting too big */ |
7448 void _icon_resize(NSImage *image) | 7453 void _icon_resize(NSImage *image) |
7449 { | 7454 { |