comparison mac/dw.m @ 2114:251d050d306b

Change dw_notification_new() to take an image path instead of an in-memory HPIXMAP. After examining all the platforms, several require the image to be on disk. It is easier to specify the path and load it on platforms requiring it in memory than to save it to disk on platforms that require it on disk. Currently it does not automatically pick an extension like some other functions, may need to add that feature here too soon. Only tested on Windows in this commit.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 23 Jun 2020 07:48:29 +0000
parents b71f46cd58b9
children cdc5124b6525
comparison
equal deleted inserted replaced
2113:aaea278c2356 2114:251d050d306b
10807 10807
10808 /* 10808 /*
10809 * Creates a new system notification if possible. 10809 * Creates a new system notification if possible.
10810 * Parameters: 10810 * Parameters:
10811 * title: The short title of the notification. 10811 * title: The short title of the notification.
10812 * pixmap: Handle to an image to display or NULL if none. 10812 * imagepath: Path to an image to display or NULL if none.
10813 * description: A longer description of the notification, 10813 * description: A longer description of the notification,
10814 * or NULL if none is necessary. 10814 * or NULL if none is necessary.
10815 * Returns: 10815 * Returns:
10816 * A handle to the notification which can be used to attach a "clicked" event if desired, 10816 * A handle to the notification which can be used to attach a "clicked" event if desired,
10817 * or NULL if it fails or notifications are not supported by the system. 10817 * or NULL if it fails or notifications are not supported by the system.
10818 * Remarks: 10818 * Remarks:
10819 * This will create a system notification that will show in the notifaction panel 10819 * This will create a system notification that will show in the notifaction panel
10820 * on supported systems, which may be clicked to perform another task. 10820 * on supported systems, which may be clicked to perform another task.
10821 */ 10821 */
10822 HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...) 10822 HWND dw_notification_new(const char *title, const char *imagepath, const char *description, ...)
10823 { 10823 {
10824 #ifdef BUILDING_FOR_MOUNTAIN_LION 10824 #ifdef BUILDING_FOR_MOUNTAIN_LION
10825 char outbuf[1025] = {0}; 10825 char outbuf[1025] = {0};
10826 HWND retval = NULL; 10826 HWND retval = NULL;
10827 10827
10859 10859
10860 if(notification) 10860 if(notification)
10861 { 10861 {
10862 notification.title = [NSString stringWithUTF8String:title]; 10862 notification.title = [NSString stringWithUTF8String:title];
10863 notification.informativeText = [NSString stringWithUTF8String:outbuf]; 10863 notification.informativeText = [NSString stringWithUTF8String:outbuf];
10864 if(pixmap && pixmap->image) 10864 if(imagepath)
10865 notification.contentImage = pixmap->image; 10865 notification.contentImage = [NSImage initByReferencingFile:[NSString stringWithUTF8String:imagepath]];
10866 retval = notification; 10866 retval = notification;
10867 } 10867 }
10868 } 10868 }
10869 return retval; 10869 return retval;
10870 #else 10870 #else