Mercurial > dwindows
comparison mac/dw.c @ 612:c5e5671dec8f
Modify Calendar widget
Amke Mac port actually compile and run
Add Clipboard support for GTK and Win
Add *from_data() contructors allowing icons, bitmaps to be created from embedded data.
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 23 Mar 2008 04:54:30 +0000 |
parents | f6de197ecbe9 |
children | 06be879f5137 |
comparison
equal
deleted
inserted
replaced
611:bc800fc67343 | 612:c5e5671dec8f |
---|---|
706 AlertType alert = kAlertPlainAlert; | 706 AlertType alert = kAlertPlainAlert; |
707 | 707 |
708 va_start(args, format); | 708 va_start(args, format); |
709 vsprintf(outbuf, format, args); | 709 vsprintf(outbuf, format, args); |
710 va_end(args); | 710 va_end(args); |
711 | 711 |
712 GetStandardAlertDefaultParams(¶m, kStdCFStringAlertVersionOne); | 712 GetStandardAlertDefaultParams(¶m, kStdCFStringAlertVersionOne); |
713 param.movable = TRUE; | 713 param.movable = TRUE; |
714 param.helpButton = FALSE; | 714 param.helpButton = FALSE; |
715 if(flags & DW_MB_INFORMATION) | 715 if(flags & DW_MB_INFORMATION) |
716 alert = kAlertNoteAlert; | 716 alert = kAlertNoteAlert; |
918 */ | 918 */ |
919 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) | 919 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) |
920 { | 920 { |
921 WindowRef hwnd = 0; | 921 WindowRef hwnd = 0; |
922 ControlRef rootcontrol = 0; | 922 ControlRef rootcontrol = 0; |
923 | 923 |
924 CreateNewWindow (kDocumentWindowClass, flStyle | kWindowStandardHandlerAttribute, | 924 CreateNewWindow (kDocumentWindowClass, flStyle | kWindowStandardHandlerAttribute, |
925 &CreationRect, &hwnd); | 925 &CreationRect, &hwnd); |
926 CreateRootControl(hwnd, &rootcontrol); | 926 CreateRootControl(hwnd, &rootcontrol); |
927 dw_window_set_text((HWND)hwnd, title); | 927 dw_window_set_text((HWND)hwnd, title); |
928 return (HWND)hwnd; | 928 return (HWND)hwnd; |
935 * pad: Number of pixels to pad around the box. | 935 * pad: Number of pixels to pad around the box. |
936 */ | 936 */ |
937 HWND API dw_box_new(int type, int pad) | 937 HWND API dw_box_new(int type, int pad) |
938 { | 938 { |
939 ControlRef hwnd = NewControl(CreationWindow, NULL, "", | 939 ControlRef hwnd = NewControl(CreationWindow, NULL, "", |
940 true, kControlSupportsEmbedding | kControlHasSpecialBackground, | 940 true, kControlSupportsEmbedding | kControlHasSpecialBackground, |
941 0, 1, kControlUserPaneProc, (SInt32) 0); | 941 0, 1, kControlUserPaneProc, (SInt32) 0); |
942 return (HWND)hwnd; | 942 return (HWND)hwnd; |
943 } | 943 } |
944 | 944 |
945 /* | 945 /* |
1288 { | 1288 { |
1289 return 0; | 1289 return 0; |
1290 } | 1290 } |
1291 | 1291 |
1292 /* | 1292 /* |
1293 * Create a new bitmap button window (widget) to be packed from data. | |
1294 * Parameters: | |
1295 * text: Bubble help text to be displayed. | |
1296 * id: An ID to be used with dw_window_from_id() or 0L. | |
1297 * data: Raw data of image. | |
1298 * (BMP on OS/2 or Windows, XPM on Unix) | |
1299 * len: Length of raw data | |
1300 */ | |
1301 HWND dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *data, int len) | |
1302 { | |
1303 return 0; | |
1304 } | |
1305 | |
1306 /* | |
1293 * Create a new spinbutton window (widget) to be packed. | 1307 * Create a new spinbutton window (widget) to be packed. |
1294 * Parameters: | 1308 * Parameters: |
1295 * text: The text to be display by the static text widget. | 1309 * text: The text to be display by the static text widget. |
1296 * id: An ID to be used with dw_window_from_id() or 0L. | 1310 * id: An ID to be used with dw_window_from_id() or 0L. |
1297 */ | 1311 */ |
1407 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) | 1421 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) |
1408 { | 1422 { |
1409 } | 1423 } |
1410 | 1424 |
1411 /* | 1425 /* |
1426 * Sets the bitmap used for a given static window. | |
1427 * Parameters: | |
1428 * handle: Handle to the window. | |
1429 * id: An ID to be used to specify the icon, | |
1430 * (pass 0 if you use the filename param) | |
1431 * data: the image data | |
1432 * Bitmap on Windows and a pixmap on Unix, pass | |
1433 * NULL if you use the id param) | |
1434 * len: length of data | |
1435 */ | |
1436 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len) | |
1437 { | |
1438 } | |
1439 | |
1440 /* | |
1412 * Sets the text used for a given window. | 1441 * Sets the text used for a given window. |
1413 * Parameters: | 1442 * Parameters: |
1414 * handle: Handle to the window. | 1443 * handle: Handle to the window. |
1415 * text: The text associsated with a given window. | 1444 * text: The text associsated with a given window. |
1416 */ | 1445 */ |
1439 if(IsValidWindowRef((WindowRef)handle)) | 1468 if(IsValidWindowRef((WindowRef)handle)) |
1440 CopyWindowTitleAsCFString((WindowRef)handle, &cftext); | 1469 CopyWindowTitleAsCFString((WindowRef)handle, &cftext); |
1441 else | 1470 else |
1442 { | 1471 { |
1443 Str255 str; | 1472 Str255 str; |
1444 | 1473 |
1445 GetControlTitle(handle, str); | 1474 GetControlTitle(handle, str); |
1446 cftext = CFStringCreateWithPascalString(NULL, str, CFStringGetSystemEncoding()); | 1475 cftext = CFStringCreateWithPascalString(NULL, str, CFStringGetSystemEncoding()); |
1447 } | 1476 } |
1448 | 1477 |
1449 if(cftext) | 1478 if(cftext) |
1678 void API dw_listbox_append(HWND handle, char *text) | 1707 void API dw_listbox_append(HWND handle, char *text) |
1679 { | 1708 { |
1680 } | 1709 } |
1681 | 1710 |
1682 /* | 1711 /* |
1712 * Appends the specified text items to the listbox's (or combobox) entry list. | |
1713 * Parameters: | |
1714 * handle: Handle to the listbox to be appended to. | |
1715 * text: Text strings to append into listbox. | |
1716 * count: Number of text strings to append | |
1717 */ | |
1718 void API dw_listbox_list_append(HWND handle, char **text, int count) | |
1719 { | |
1720 } | |
1721 | |
1722 /* | |
1683 * Clears the listbox's (or combobox) list of all entries. | 1723 * Clears the listbox's (or combobox) list of all entries. |
1684 * Parameters: | 1724 * Parameters: |
1685 * handle: Handle to the listbox to be cleared. | 1725 * handle: Handle to the listbox to be cleared. |
1686 */ | 1726 */ |
1687 void API dw_listbox_clear(HWND handle) | 1727 void API dw_listbox_clear(HWND handle) |
2202 { | 2242 { |
2203 return 0; | 2243 return 0; |
2204 } | 2244 } |
2205 | 2245 |
2206 /* | 2246 /* |
2247 * Obtains an icon from data. | |
2248 * Parameters: | |
2249 * data: Source of data for image. | |
2250 * len: length of data | |
2251 */ | |
2252 unsigned long API dw_icon_load_from_data(char *data, int len) | |
2253 { | |
2254 return 0; | |
2255 } | |
2256 | |
2257 /* | |
2207 * Frees a loaded resource in OS/2 and Windows. | 2258 * Frees a loaded resource in OS/2 and Windows. |
2208 * Parameters: | 2259 * Parameters: |
2209 * handle: Handle to icon returned by dw_icon_load(). | 2260 * handle: Handle to icon returned by dw_icon_load(). |
2210 */ | 2261 */ |
2211 void API dw_icon_free(unsigned long handle) | 2262 void API dw_icon_free(unsigned long handle) |
2244 * row: Zero based row of data being set. | 2295 * row: Zero based row of data being set. |
2245 * data: Pointer to the data to be added. | 2296 * data: Pointer to the data to be added. |
2246 */ | 2297 */ |
2247 void API dw_container_change_item(HWND handle, int column, int row, void *data) | 2298 void API dw_container_change_item(HWND handle, int column, int row, void *data) |
2248 { | 2299 { |
2300 } | |
2301 | |
2302 /* | |
2303 * Changes an existing item in specified row and column to the given data. | |
2304 * Parameters: | |
2305 * handle: Handle to the container window (widget). | |
2306 * column: Zero based column of data being set. | |
2307 * row: Zero based row of data being set. | |
2308 * data: Pointer to the data to be added. | |
2309 */ | |
2310 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data) | |
2311 { | |
2312 dw_filesystem_set_item(handle, NULL, column, row, data); | |
2313 } | |
2314 | |
2315 /* | |
2316 * Changes an item in specified row and column to the given data. | |
2317 * Parameters: | |
2318 * handle: Handle to the container window (widget). | |
2319 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
2320 * column: Zero based column of data being set. | |
2321 * row: Zero based row of data being set. | |
2322 * data: Pointer to the data to be added. | |
2323 */ | |
2324 void API dw_filesystem_change_file(HWND handle, int row, char *filename, unsigned long icon) | |
2325 { | |
2326 dw_filesystem_set_file(handle, NULL, row, filename, icon); | |
2249 } | 2327 } |
2250 | 2328 |
2251 /* | 2329 /* |
2252 * Sets an item in specified row and column to the given data. | 2330 * Sets an item in specified row and column to the given data. |
2253 * Parameters: | 2331 * Parameters: |
2577 * (BMP on OS/2 or Windows, XPM on Unix) | 2655 * (BMP on OS/2 or Windows, XPM on Unix) |
2578 * Returns: | 2656 * Returns: |
2579 * A handle to a pixmap or NULL on failure. | 2657 * A handle to a pixmap or NULL on failure. |
2580 */ | 2658 */ |
2581 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename) | 2659 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename) |
2660 { | |
2661 return 0; | |
2662 } | |
2663 | |
2664 /* | |
2665 * Creates a pixmap from data | |
2666 * Parameters: | |
2667 * handle: Window handle the pixmap is associated with. | |
2668 * data: Source of image data | |
2669 * DW pick the appropriate file extension. | |
2670 * (BMP on OS/2 or Windows, XPM on Unix) | |
2671 * Returns: | |
2672 * A handle to a pixmap or NULL on failure. | |
2673 */ | |
2674 HPIXMAP API dw_pixmap_new_from_data(HWND handle, char *data, int len) | |
2582 { | 2675 { |
2583 return 0; | 2676 return 0; |
2584 } | 2677 } |
2585 | 2678 |
2586 /* | 2679 /* |
2931 { | 3024 { |
2932 return 0.0; | 3025 return 0.0; |
2933 } | 3026 } |
2934 | 3027 |
2935 /* | 3028 /* |
3029 * Creates a calendar window (widget) with given parameters. | |
3030 * Parameters: | |
3031 * id: Unique identifier for calendar widget | |
3032 * Returns: | |
3033 * A handle to a calendar window or NULL on failure. | |
3034 */ | |
3035 HWND dw_calendar_new(unsigned long id) | |
3036 { | |
3037 return 0; | |
3038 } | |
3039 | |
3040 /* | |
3041 * Sets the current date of a calendar | |
3042 * Parameters: | |
3043 * handle: The handle to the calendar returned by dw_calendar_new(). | |
3044 * year... | |
3045 */ | |
3046 void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) | |
3047 { | |
3048 return; | |
3049 } | |
3050 | |
3051 /* | |
3052 * Gets the position of a splitbar (pecentage). | |
3053 * Parameters: | |
3054 * handle: The handle to the splitbar returned by dw_splitbar_new(). | |
3055 */ | |
3056 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) | |
3057 { | |
3058 return; | |
3059 } | |
3060 | |
3061 /* | |
2936 * Pack windows (widgets) into a box from the start (or top). | 3062 * Pack windows (widgets) into a box from the start (or top). |
2937 * Parameters: | 3063 * Parameters: |
2938 * box: Window handle of the box to be packed into. | 3064 * box: Window handle of the box to be packed into. |
2939 * item: Window handle of the item to be back. | 3065 * item: Window handle of the item to be back. |
2940 * width: Width in pixels of the item or -1 to be self determined. | 3066 * width: Width in pixels of the item or -1 to be self determined. |
3008 * ext: Default file extention. | 3134 * ext: Default file extention. |
3009 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | 3135 * flags: DW_FILE_OPEN or DW_FILE_SAVE. |
3010 * Returns: | 3136 * Returns: |
3011 * NULL on error. A malloced buffer containing | 3137 * NULL on error. A malloced buffer containing |
3012 * the file path on success. | 3138 * the file path on success. |
3013 * | 3139 * |
3014 */ | 3140 */ |
3015 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) | 3141 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) |
3016 { | 3142 { |
3017 return NULL; | 3143 return NULL; |
3018 } | 3144 } |