Mercurial > dwindows
comparison mac/dw.c @ 441:b559c06a76c2
Implemented more functionality on MacOS and include the platform define
in the dw-config C flags.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 30 May 2003 00:47:47 +0000 |
parents | 903fb3085d42 |
children | e99cd6e45c0b |
comparison
equal
deleted
inserted
replaced
440:9af47c551a56 | 441:b559c06a76c2 |
---|---|
686 * Parameters: | 686 * Parameters: |
687 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | 687 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
688 */ | 688 */ |
689 void * API dw_dialog_wait(DWDialog *dialog) | 689 void * API dw_dialog_wait(DWDialog *dialog) |
690 { | 690 { |
691 void *tmp; | 691 void *tmp; |
692 | 692 EventRecord eventStructure; |
693 #if 0 | 693 |
694 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | 694 while(!dialog->done) |
695 { | 695 { |
696 WinDispatchMsg(dwhab, &qmsg); | 696 if(WaitNextEvent(everyEvent, &eventStructure, 180, 0)) |
697 if(dialog->done) | 697 _doEvents(&eventStructure); |
698 break; | 698 } |
699 } | |
700 #endif | |
701 dw_event_close(&dialog->eve); | 699 dw_event_close(&dialog->eve); |
702 tmp = dialog->result; | 700 tmp = dialog->result; |
703 free(dialog); | 701 free(dialog); |
704 return tmp; | 702 return tmp; |
705 } | 703 } |
714 */ | 712 */ |
715 int API dw_messagebox(char *title, int flags, char *format, ...) | 713 int API dw_messagebox(char *title, int flags, char *format, ...) |
716 { | 714 { |
717 va_list args; | 715 va_list args; |
718 char outbuf[1024]; | 716 char outbuf[1024]; |
717 AlertStdCFStringAlertParamRec param; | |
718 DialogRef dialog; | |
719 CFStringRef cftext, cftitle; | |
720 DialogItemIndex item; | |
721 int ret = DW_MB_RETURN_OK; | |
722 AlertType alert = kAlertPlainAlert; | |
719 | 723 |
720 va_start(args, format); | 724 va_start(args, format); |
721 vsprintf(outbuf, format, args); | 725 vsprintf(outbuf, format, args); |
722 va_end(args); | 726 va_end(args); |
723 | 727 |
724 #if 0 | 728 GetStandardAlertDefaultParams(¶m, kStdCFStringAlertVersionOne); |
725 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, MB_OK | MB_INFORMATION | MB_MOVEABLE); | 729 param.movable = TRUE; |
726 #endif | 730 param.helpButton = FALSE; |
727 | 731 if(flags & DW_MB_INFORMATION) |
728 return strlen(outbuf); | 732 alert = kAlertNoteAlert; |
733 else if(flags & DW_MB_ERROR) | |
734 alert = kAlertStopAlert; | |
735 else if(flags & DW_MB_WARNING) | |
736 alert = kAlertCautionAlert; | |
737 | |
738 if(flags & DW_MB_OK || flags & DW_MB_OKCANCEL) | |
739 { | |
740 param.defaultText = CFSTR("Ok"); | |
741 param.cancelText = flags & DW_MB_OK ? 0 : CFSTR("Cancel"); | |
742 } | |
743 else | |
744 { | |
745 param.defaultText = CFSTR("Yes"); | |
746 param.cancelText = CFSTR("No"); | |
747 param.otherText = CFSTR("Cancel"); | |
748 } | |
749 cftext = CFStringCreateWithCString(NULL, outbuf, kCFStringEncodingDOSLatinUS); | |
750 cftitle = CFStringCreateWithCString(NULL, title, kCFStringEncodingDOSLatinUS); | |
751 if(CreateStandardAlert(alert, cftext, cftitle, ¶m, &dialog) == noErr) | |
752 { | |
753 if(RunStandardAlert(dialog, NULL, &item) == noErr) | |
754 { | |
755 if(item == kAlertStdAlertOtherButton) | |
756 ret = DW_MB_RETURN_CANCEL; | |
757 else if(item == kAlertStdAlertCancelButton) | |
758 { | |
759 if(flags & DW_MB_OK || flags & DW_MB_OKCANCEL) | |
760 ret = DW_MB_RETURN_CANCEL; | |
761 else | |
762 ret = DW_MB_RETURN_NO; | |
763 } | |
764 } | |
765 } | |
766 CFRelease(cftext); | |
767 CFRelease(cftitle); | |
768 return ret; | |
729 } | 769 } |
730 | 770 |
731 /* | 771 /* |
732 * Makes the window topmost. | 772 * Makes the window topmost. |
733 * Parameters: | 773 * Parameters: |
871 * handle: Handle to widget for which to change. | 911 * handle: Handle to widget for which to change. |
872 * cursortype: ID of the pointer you want. | 912 * cursortype: ID of the pointer you want. |
873 */ | 913 */ |
874 void API dw_window_pointer(HWND handle, int pointertype) | 914 void API dw_window_pointer(HWND handle, int pointertype) |
875 { | 915 { |
916 SetCursor(*GetCursor(pointertype)); | |
876 } | 917 } |
877 | 918 |
878 /* | 919 /* |
879 * Create a new Window Frame. | 920 * Create a new Window Frame. |
880 * Parameters: | 921 * Parameters: |