home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / basecntr / bcmain.h < prev    next >
C/C++ Source or Header  |  1997-04-02  |  7KB  |  215 lines

  1. /* @(#) 1.54 com/src/samples/basecntr/bcmain.h, odbasepart, od96os2, odos29714c 3/25/97 13:46:05 [4/2/97 17:20:01] */
  2.  
  3. //====START_GENERATED_PROLOG======================================
  4. //
  5. //
  6. //   COMPONENT_NAME: odsamples
  7. //
  8. //   CLASSES: none
  9. //
  10. //   ORIGINS: 82,27
  11. //
  12. //
  13. //   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  14. //   All Rights Reserved
  15. //   Licensed Materials - Property of IBM
  16. //   US Government Users Restricted Rights - Use, duplication or
  17. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18. //
  19. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  20. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  21. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  22. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  23. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  24. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  25. //   OR PERFORMANCE OF THIS SOFTWARE.
  26. //
  27. //====END_GENERATED_PROLOG========================================
  28. //
  29.  
  30.  
  31. #ifndef BaseContainer_Header
  32. #define BaseContainer_Header
  33.  
  34.  
  35.  
  36. // CMD_Offset is set to the MENUID_ACTIVEPART_USER as defined in CMDDEFS.XH
  37. // This is an area reserved for USER defined menuitems.
  38.  
  39.  
  40. #define CMD(X)    kODCommand##X
  41.  
  42. #define CMD_Offset                 MENUID_ACTIVEPART_USER
  43. const   ODMenuID  kODEmbedMenuID = CMD_Offset;
  44. #define kODCommandDash             (CMD_Offset+1)
  45. #define kODCommandMove             (CMD_Offset+2)
  46. #define kODCommandMoveFront        (CMD_Offset+3)
  47. #define kODCommandMoveBack         (CMD_Offset+4)
  48. #define kODCommandResize           (CMD_Offset+5)
  49. #define kODCommandHelp             (CMD_Offset+6)
  50. const   ODMenuID  kODOptionsMenuID = (CMD_Offset+60);
  51. #define kODCommandColorCHANGE        (CMD_Offset+61)
  52.  
  53. #define kODCommandParts            (CMD_Offset+400)
  54. #define CMD_Offset_Subclass        (CMD_Offset+500)
  55.  
  56. #define kODErrCannotInitializePart 3001
  57.  
  58. // Property names
  59. #define kODPropBackgroundColor     "+//ISO 9070/ANSI::113722::US::CI LABS::IBM:Property:BackgroundColor"
  60. static const ODPropertyName kPropBackground = "+//ISO 9070/ANSI::113722::US::CI LABS::IBM:Value:NTColor";
  61. // the below definition was removed per DEFECT 22908 and added to StdDefs.idl
  62. //#define kODPropEmbeddedFrames     "BaseContainer:Property:EmbeddedFrames"
  63.  
  64. // Frame List Value Type
  65. const ODValueType kODFrameList = "+//ISO 9070/ANSI::113722:US::CI LABS:MacOS:Type:FrameList";
  66.  
  67. // Frame List User String
  68. #define kODFrameListUserString "Frame List"
  69.  
  70.  
  71. #define kBaseContainerPartKind                  "IBM:BaseContainer:PartKind"
  72. #define kBaseContainerPartHandlerName           "BaseContainer"
  73. #define kBaseContainerPartHandlerDisplayName    "IBM Base ContainerPart"
  74. const   ODType   kBaseContainerPartKindDisplayName = "IBM BaseContainer Kind";
  75. const   ODType   kBaseContainerPartCategory        = "Container";
  76.  
  77. static const ODPropertyName kBCSuggestedTransform = "BaseContainer:Transform";
  78.  
  79.  
  80. // ----------------------------------------------------------
  81. // NLS Message constants used in BaseContainer --> Initialize
  82. //
  83. //      The BCMSG_SET and BC_* messages must conform to what
  84. //      is shown in the XPG/4 Message catalog file BCPART.MSG
  85. // ----------------------------------------------------------
  86.  
  87. #include <locale.h>
  88. #include <wchar.h>
  89. #include <ODDebug.h>
  90.  
  91. #define BC_NLS_CATALOG "iodbasec.cat" // BCPART Messages are stored in IODBASEC.MSG
  92. #include <iodbasec.h>                 // BC_* constants are defined in IODBASEC.H
  93.  
  94. #if !(defined(__IBMCPP__) || defined(_IBMR2))
  95. typedef ODPtr nl_catd;
  96. #endif
  97.  
  98. // PLATFORMSTRID macro. Used to determine catalog string to read for menu
  99. // items requiring mnemonics. There will be one string and BC_ constant pair
  100. // for each platform. Constants end with _OS2, _WIN, or _AIX to differentiate
  101. // amongst them.
  102. #ifdef _PLATFORM_OS2_
  103.    #define PLATFORMSTRID(X)      X##_OS2
  104. #elif defined(_PLATFORM_WIN32_)
  105.    #define PLATFORMSTRID(X)      X##_WIN
  106. #else
  107.    #define PLATFORMSTRID(X)      X##_UNX
  108. #endif
  109.  
  110. #ifdef _PLATFORM_OS2_
  111. typedef HPS HDraw;
  112. typedef HBITMAP HIconView;
  113. typedef HBITMAP HThumbView;
  114. typedef HMODULE HResModule;
  115.  
  116. #elif defined(_PLATFORM_WIN32_)
  117. typedef HDC HDraw;
  118. typedef HICON HIconView;
  119. typedef HBITMAP HThumbView;
  120. typedef HINSTANCE HResModule;
  121.  
  122. #elif defined(_PLATFORM_UNIX_)
  123. typedef GC HDraw;
  124. typedef Pixmap HIconView;
  125. typedef Pixmap HThumbView;
  126. typedef int HResModule;
  127. #endif
  128.  
  129.  
  130. // mouse position displayed for insertion point of dropped or pasted data
  131.  
  132. #define BC_NPOINTS 5            // # of points to make a cross hair mark
  133.  
  134. #if defined(_PLATFORM_OS2_)      // defines in platform specific terms,
  135. typedef long COLORREF;           // those variables that are WIN specific
  136. typedef POINTL POINT;
  137. #endif
  138. #if defined(_PLATFORM_UNIX_)
  139. typedef Pixel COLORREF;
  140. typedef XPoint POINT;
  141. #define MAX_PIXEL 5;             // arbitrary maximum distance allowed in points
  142. #endif                           // for mouse mvmt to still be part of a dblclk
  143.  
  144. // Data structure stored with frame to hold frame-specific values
  145. typedef struct
  146. {
  147.     ODBoolean NeedsActivating;
  148.     COLORREF  BgndColor;             // remember the frame's Bgnd color
  149. #if defined (_PLATFORM_OS2_)
  150.     ODRect  frameRect;
  151. #endif
  152. } FramePartInfo;
  153.  
  154. typedef struct
  155. {
  156.     POINT           hotSpot;
  157.     unsigned short  simEvent;
  158.     POINT           maxDistance;
  159.     ODRect          frameRect;
  160.     ODEventData     event;
  161.     ODEventInfo     eventInfo;
  162. } BC_MOUSETRACK;
  163.  
  164. typedef struct
  165. {
  166.     ODPoint offset;
  167.     ODPoint extent;
  168.     ODPoint scale;
  169.     ODULong numFrames;
  170. } FrameListHeader;
  171.  
  172. #define DEFAULT_EMBED_WIDTH 100  // default width of a part created from embed menu
  173. #define DEFAULT_EMBED_HEIGHT 100  // default height of a part created from embed menu
  174.  
  175. // Mouse modes to be used for tracking edit operations
  176. #define kMouseModeNull 0
  177. #define kMouseModeEmbedFromMenu 1
  178. #define kMouseModeTrackMove 2
  179. #define kMouseModeTrackResize 3
  180. #define kMouseModeTrackPaste 4
  181. #define kMouseModeTrackPasteAs 5
  182. #define kMouseModeTrackMouseMove 6
  183. #define kMouseModeTrackMouseResize 7
  184. #define kMouseModeTrackLassoSelect 8
  185.  
  186. // Constants for defining the selection border
  187. #if defined(_PLATFORM_WIN32_)
  188. #define MAKEFIXED(h, l)  ((ULONG) ( ((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16) )
  189. #elif defined(_PLATFORM_UNIX_)
  190. #define MAKEFIXED(h, l)  ((unsigned long) ( ((unsigned short)(l)) | ((unsigned long)((unsigned short)(h))) << 16) )
  191. #endif
  192.  
  193.  
  194. typedef enum BC_CHANGE {BCC_EMBED, BCC_PASTE, BCC_PASTEAS, BCC_RESIZE, BCC_MOVE,
  195.                         BCC_DELETE, BCC_INTRINSIC, BCC_EMBEDUPDATED, BCC_DROP, BCC_EMBEDSHAPECHANGED};
  196.  
  197. typedef enum BC_RECTDRAWTYPE {BCR_REDRAW, BCR_ERASE};
  198.  
  199. const ODSLong kODBorderWidth = MAKEFIXED(4,0);
  200. const ODSLong kODHandleLenMultiplier = 3;
  201.  
  202. #define kBCSingleClick 1
  203. #define kBCMouseDrag 2
  204.  
  205. #define ODDeleteObject(OBJ) \
  206.      if( !(OBJ) ) ; else { delete (OBJ); (OBJ)=kODNULL; }
  207.  
  208.  
  209. // Convert color in 0x00RRGGBB format to 0x00BBGGRR format and vice-versa
  210. #define ExchangeRedAndBlue(color) \
  211.      color = ((color & 0x0000FF) << 16) | (color & 0x00FF00) | ((color & 0xFF0000) >> 16);
  212.  
  213.  
  214. #endif
  215.