home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Snippets / DirectoryPopup 1.0 / □□□DPSample Source / SimpleApp.h < prev    next >
Encoding:
Text File  |  1996-06-03  |  3.4 KB  |  163 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    Project:        SimpleApp
  3.  *
  4.  *    Filename:         SimpleApp.h
  5.  *
  6.  *    Author:         Marco Piovanelli
  7.  *
  8.  *    Revision History:
  9.  *
  10.  *            1996.05.24                MP        created this file
  11.  *
  12.  */
  13.  
  14.  
  15. //    conditional macros
  16.  
  17. #ifndef SystemSevenOrLater
  18. #define SystemSevenOrLater 1
  19. #endif
  20.  
  21. #ifndef OLDROUTINENAMES
  22. #define OLDROUTINENAMES 0
  23. #endif
  24.  
  25. #ifndef OLDROUTINELOCATIONS
  26. #define OLDROUTINELOCATIONS 0
  27. #endif
  28.  
  29. #ifndef CGLUESUPPORTED
  30. #define CGLUESUPPORTED 0
  31. #endif
  32.  
  33. #ifndef STRICT_WINDOWS
  34. #define STRICT_WINDOWS 1
  35. #endif
  36.  
  37. #ifndef STRICT_MENUS
  38. #define STRICT_MENUS 1
  39. #endif
  40.  
  41. //    toolbox #includes
  42.  
  43. #ifndef __CONDITIONALMACROS__
  44. #include <ConditionalMacros.h>
  45. #endif
  46.  
  47. #ifndef __TYPES__
  48. #include <Types.h>
  49. #endif
  50.  
  51. #ifndef __RESOURCES__
  52. #include <Resources.h>
  53. #endif
  54.  
  55. #ifndef __MEMORY__
  56. #include <Memory.h>
  57. #endif
  58.  
  59. #ifndef __WINDOWS__
  60. #include <Windows.h>
  61. #endif
  62.  
  63. #ifndef __MENUS__
  64. #include <Menus.h>
  65. #endif
  66.  
  67. #ifndef __TEXTEDIT__
  68. #include <TextEdit.h>
  69. #endif
  70.  
  71. #ifndef __DIALOGS__
  72. #include <Dialogs.h>
  73. #endif
  74.  
  75. #ifndef __SCRAP__
  76. #include <Scrap.h>
  77. #endif
  78.  
  79. #ifndef __DISKINIT__
  80. #include <DiskInit.h>
  81. #endif
  82.  
  83. #ifndef __APPLEEVENTS__
  84. #include <AppleEvents.h>
  85. #endif
  86.  
  87. #ifndef __AEREGISTRY__
  88. #include <AERegistry.h>
  89. #endif
  90.  
  91. //        resource IDs
  92.  
  93. const SInt16 kMenuBarID = 128 ;
  94. const SInt16 kWindowTemplateID = 128 ;
  95.  
  96. //        menu IDs
  97.  
  98. const SInt16 kMenuApple = 1 ;
  99. const SInt16 kMenuFile = 2 ;
  100.  
  101. //        menu item IDs
  102.  
  103. const SInt16 kItemAbout = 1 ;
  104. const SInt16 kItemNew = 1 ;
  105. const SInt16 kItemOpen = 2 ;
  106. const SInt16 kItemClose = 4 ;
  107. const SInt16 kItemSave = 5 ;
  108. const SInt16 kItemQuit = 7 ;
  109.  
  110. //        other miscellaneous constants
  111.  
  112. const SInt32 kMoreMasters = 5 ;
  113. const SInt32 kScrapThreshold = 16 * 1024 ;        //    16 KB
  114. const UInt32 kDefaultSleep = 5 * 60 ;            //    5 seconds
  115.  
  116. //        globals
  117.  
  118. extern Boolean gExiting ;
  119.  
  120. void main ( ) ;
  121. OSErr Initialize ( ) ;
  122. OSErr Finalize ( ) ;
  123.  
  124. //        defined in SimpleAppEvents.c
  125.  
  126. OSErr InitializeEvents ( ) ;
  127. void ProcessEvent ( ) ;
  128. void DoNullEvent ( EventRecord & event ) ;
  129. void DoMouseDownEvent ( EventRecord & event ) ;
  130. void DoKeyDownEvent ( EventRecord & event ) ;
  131. void DoWindowEvent ( EventRecord & event ) ;
  132. void DoDiskEvent ( EventRecord & event ) ;
  133. void DoOSEvent ( EventRecord & event ) ;
  134. void DoHighLevelEvent ( EventRecord & event ) ;
  135.  
  136. //        defined in SimpleAppAEHandlers.c
  137.  
  138. OSErr GotRequiredParams ( const AppleEvent * ae ) ;
  139. pascal OSErr HandleOpenApp ( const AppleEvent * ae, AppleEvent * reply, SInt32 refCon ) ;
  140. pascal OSErr HandleOpenDoc ( const AppleEvent * ae, AppleEvent * reply, SInt32 refCon ) ;
  141. pascal OSErr HandleQuit ( const AppleEvent * ae, AppleEvent * reply, SInt32 refCon ) ;
  142.  
  143. //        defined in SimpleAppMenus.c
  144.  
  145. OSErr InitializeMenus ( ) ;
  146. OSErr PrepareMenus ( ) ;
  147. OSErr DoMenuChoice ( SInt32 menuChoice ) ;
  148. OSErr DoDeskAccessory ( SInt16 menuItem ) ;
  149. OSErr DoAppleChoice ( SInt16 menuItem ) ;
  150. OSErr DoFileChoice ( SInt16 menuItem ) ;
  151.  
  152. //        defined in SimpleAppWindows.c
  153.  
  154. OSErr CreateWindow ( const FSSpec * fileSpec ) ;
  155. OSErr DestroyWindow ( WindowRef macWindow ) ;
  156. void DoContent ( WindowRef macWindow, Point hitPt, const EventRecord & event ) ;
  157. void DoDrag ( WindowRef macWindow, Point hitPt, const EventRecord & event ) ;
  158. void DoGoAway ( WindowRef macWindow, const EventRecord & event ) ;
  159. void DoZoom ( WindowRef macWindow, SInt16 partCode, const EventRecord & event ) ;
  160. void DoGrow ( WindowRef macWindow, Point hitPt, const EventRecord & event ) ;
  161. void DoUpdate ( WindowRef macWindow, RgnHandle invalidRgn ) ;
  162. void DoActivate ( WindowRef macWindow, Boolean isActivating ) ;
  163.