home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Sample Code / MacCalendar 1.0 / Src / MacCalendar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-17  |  3.8 KB  |  115 lines  |  [TEXT/KAHL]

  1. /*                                    MacCalendar.h                                    */
  2. /*
  3.  * MacCalendar.h
  4.  * Copyright © 1993-94 Apple Computer Inc. All rights reserved.
  5.  *
  6.  * Edit History:
  7.  *    1.0d0    MM    First "public" distribution.
  8.  *    1.0d1    MM    Added the setup application.
  9.  *    1.0d2    MM    Added balloon help to the setup dialog. Added a "can't
  10.  *                find preference file alert." No substantive changes.
  11.  *    1.0d3    MM    Some small fixes from the Status Bar author. Now hiliting
  12.  *                the days of the week and today's date if shown.
  13.  *    1.0d4    MM    Revised to use the current ControlStrip header file. Removed
  14.  *                references to a local copy of Icons.h as the Universal Header
  15.  *                distribution has this information. Shrunk next/last month buttons.
  16.  *                Make a copy of the intlHdl so we don't change the system info.
  17.  *    1.0d4    MM    Bug displaying October 1994 - blank first line.
  18.  */
  19. #define kApplicationCreator    'SCAL'
  20. #define ICON_Calendar        128
  21. #define ICON_StatusBar        256
  22. #define FREF_Calendar        128
  23. #define BNDL_Calendar        128
  24. #define STRN_Info            256
  25. #define PICT_RightArrow        128
  26. #define    kIconWidth            16
  27. #define kVersionMajor        1
  28. #define kVersionMinor        0
  29. #define kVersionStage        development
  30. #define kVersionRelease        5
  31. #define kVersionIdent        "1.0d5"
  32. #define kVersionString        "1.0d5 © 1993-94 Apple Computer Inc."
  33. #define kCalendarPrefName    "MacCalendar Preferences"    /* No \p */
  34. #define kFirstIsSunday        1
  35. #define kFirstIsMonday        2
  36. #ifndef REZ
  37. #ifndef FALSE
  38. #define FALSE                0
  39. #define TRUE                1
  40. #endif
  41.  
  42. /*
  43.  * This is saved across restarts - it is set from "factory settings" if no
  44.  * preference resource is found in the Status Bar preference file, and can
  45.  * be changed by the MacCalendarSetup application.
  46.  */
  47. typedef struct SavedSettings {
  48.     OSType            signature;                    /* Our signature                    */
  49.     OSType            prefVersion;                /* Preference revision level        */                
  50.     Str255            dateString;                    /* Current date label string        */
  51.     Str255            fontName;                    /* Requested display font            */
  52.     short            fontSize;                    /* Display font size                */
  53.     short            firstDayOfWeek;                /* Sunday == 1                        */
  54. } SavedSettings, **SavedSettingsHandle;
  55.  
  56. /*
  57.  * The value of kPrefVersion has no special significance. It should be changed
  58.  * whenever the SavedSettings resource is changed, or whenever it you desire to
  59.  * redefine the SavedSettings resource (for example, during debugging).
  60.  */
  61. #define kPrefVersion        ('1002')            /* Change this to rebuild pref's    */
  62. enum {
  63.     kStringPreference = 1,
  64.     kStringHelp,
  65.     kStringFontName,
  66.     kStringFontSize,
  67.     kStringFirstDayOfWeek,
  68.     kStringDayNames
  69. };
  70.  
  71. enum {
  72.     kMsgReadingPrefResource,
  73.     kMsgWritingPrefResource,
  74.     kMsgSystemError
  75. };
  76.     
  77. /*
  78.  * These functions are defined in DrawCalendar.c. They are not specific to
  79.  * the Status Bar module interface.
  80.  */
  81. /*
  82.  * DrawCalendar draws the current calendar in the current port in the specified
  83.  * display area.
  84.  */
  85. void                        DrawCalendar(
  86.         short                    year,            /* 1904 ..                    */
  87.         short                    month,            /* January == 1                */
  88.         short                    firstDayOfWeek,    /* Sunday = 1, Monday 2        */
  89.         const unsigned char        *dayName,        /* Day of week string        */
  90.         const Rect                *displayRect,    /* Where to draw the text    */
  91.         short                    fontNumber,        /* Display font                */
  92.         short                    fontSize        /* Display font size        */
  93.     );
  94. /*
  95.  * GetCalendarDisplaySize returns the size of the calendar if it is to be drawn
  96.  * in the specified fontNumber and fontSize.
  97.  */
  98. Point                        GetCalendarDisplaySize(
  99.         short                    fontNumber,        /* Display font                */
  100.         short                    fontSize        /* Display font size        */
  101.     );
  102. /*
  103.  * GetCalendarMonthRect uses the fontNumber and fontSize to compute the size
  104.  * size of the calendar as it will be drawn. Then the function creates an
  105.  * actual display rectangle that is centered in the specified displayRect.
  106.  */
  107. void                        GetCalendarMonthRect(
  108.         short                    fontNumber,        /* Display font                */
  109.         short                    fontSize,        /* Display font size        */
  110.         const Rect                *displayRect,    /* Where to draw the text    */
  111.         Rect                    *monthRect        /* Returns drawing rect        */
  112.     );
  113. #endif /* REZ */
  114.  
  115.