home *** CD-ROM | disk | FTP | other *** search
- /* Add.c -- Modal dialog */
- /* Created 01/01/95 12:01 PM by AppMaker */
-
- #include <Types.h>
- #include <Quickdraw.h>
- #include <Controls.h>
- #include <Dialogs.h>
- #include <Events.h>
- #include <Lists.h>
- #include <Menus.h>
- #include <TextEdit.h>
- #include "ResourceDefs.h"
- #include "Miscellany.h"
- #include "DialogAids.h"
- #include "WindowAids.h"
- #include "Add.h"
-
- #define OKButton 1
- #define CancelButton 2
- #define LogoPicture 3
- #define AddReminderForLabel 4
- #define DateLabel 5
- #define DateField 6
- #define TimeLabel 7
- #define TimeField 8
- #define AMRadio 9
- #define PMRadio 10
- #define MessageLabel 11
- #define MessageField 12
- #define WhenRemindingLabel 13
- #define DisplayIconCheck 14
- #define DisplayAlertCheck 15
- #define PlaySoundCheck 16
- #define SoundLabel 17
- #define SoundPopup 18
-
- static void DoLogoPicture (void);
- static pascal void DrawSoundPopup (DialogPtr whichDialog,
- short itemNr);
-
- /*----------*/
- static void DoLogoPicture ()
- {
- } /*DoLogoPicture*/
-
- /*----------*/
- static pascal void DrawSoundPopup (DialogPtr whichDialog,
- short itemNr)
- {
- AddRecPtr data;
-
- data = (AddRecPtr) GetWRefCon (whichDialog);
- DrawPopup (itemNr, MENU_Sound, data->SoundChoice);
- } /*DrawSoundPopup*/
-
- /*----------*/
- Boolean GetAdd (AddRec *Add)
- {
- DialogPtr theDialog;
- GrafPtr savePort;
- Boolean result;
- Boolean done;
- short itemNr;
- register AddRecPtr info;
- ModalFilterUPP FilterAddUPP;
- UserItemUPP DrawSoundPopupUPP;
-
- GetPort (&savePort);
- InitCursor ();
- theDialog = GetNewDialog (DLOG_Add, nil, (WindowPtr) -1L);
- SetWRefCon (theDialog, (long) Add);
- SetPort (theDialog);
- info = Add;
- SetDText (DateField, info->DateText);
- SetDText (TimeField, info->TimeText);
- SetRadio (AMRadio, info->AmPmChoice);
- SetDText (MessageField, info->MessageText);
- SetCheckbox (DisplayIconCheck, info->DisplayIconChecked);
- SetCheckbox (DisplayAlertCheck, info->DisplayAlertChecked);
- SetCheckbox (PlaySoundCheck, info->PlaySoundChecked);
- DrawSoundPopupUPP = NewUserItemProc (DrawSoundPopup);
- SetUserItem (SoundPopup, DrawSoundPopupUPP);
- FilterAddUPP = NewModalFilterProc (StandardFilter);
-
- ShowWindow (theDialog);
- OutlineButton (1);
- done = false;
- while (!done) {
-
- MovableDialog (FilterAddUPP, &itemNr);
- switch (itemNr) {
- case OKButton:
- result = true;
- done = true;
- break;
- case CancelButton:
- result = false;
- done = true;
- break;
- case LogoPicture:
- DoLogoPicture ();
- break;
- case DateField:
- GetDText (itemNr, info->DateText);
- break;
- case TimeField:
- GetDText (itemNr, info->TimeText);
- break;
- case AMRadio:
- case PMRadio:
- DoRadio (AMRadio, itemNr, &info->AmPmChoice);
- break;
- case MessageField:
- GetDText (itemNr, info->MessageText);
- break;
- case DisplayIconCheck:
- DoCheckbox (itemNr, &info->DisplayIconChecked);
- break;
- case DisplayAlertCheck:
- DoCheckbox (itemNr, &info->DisplayAlertChecked);
- break;
- case PlaySoundCheck:
- DoCheckbox (itemNr, &info->PlaySoundChecked);
- break;
- case SoundPopup:
- InvertLabel (SoundLabel);
- DoPopup (SoundPopup, MENU_Sound, &info->SoundChoice);
- InvertLabel (SoundLabel);
- PlaySound (MENU_Sound, info->SoundChoice);
- break;
-
- } /* switch */
- } /* while */
- DisposeRoutineDescriptor ((UniversalProcPtr) FilterAddUPP);
- DisposeRoutineDescriptor ((UniversalProcPtr) DrawSoundPopupUPP);
-
- DisposDialog (theDialog);
- SetPort (savePort);
- return (result);
- } /*GetAdd*/
-
- /* Add */
-