home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / odtlktv4.zip / ODTLKT / TOOLKIT / SAMPLES / OPENDOC / PARTS / TTAPE1 / TTAPE1.HPP < prev    next >
Text File  |  1995-12-15  |  6KB  |  163 lines

  1. /***********************************************************************
  2. *
  3. *  File Name   : TTAPE1.HPP
  4. *
  5. *  Description : TickerTape1Part class header file.
  6. *
  7. *  Notes       : N/A
  8. *
  9. *     (C) COPYRIGHT International Business Machines Corp. 1995
  10. *     All Rights Reserved
  11. *     Licensed Materials - Property of IBM
  12. *
  13. *     US Government Users Restricted Rights - Use, duplication or
  14. *     disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15. *
  16. *     DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  17. *     sample code created by IBM Corporation. This sample code is not
  18. *     part of any standard or IBM product and is provided to you solely
  19. *     for the purpose of assisting you in the development of your
  20. *     applications.  The code is provided "AS IS", without
  21. *     warranty of any kind.  IBM shall not be liable for any damages
  22. *     arising out of your use of the sample code, even if they have been
  23. *     advised of the possibility of such damages.
  24. *
  25. ***********************************************************************/
  26. #ifndef _TTAPE1_HPP_
  27. #define _TTAPE1_HPP_
  28.  
  29. #ifndef SOM_Module_CmdDefs_OpenDoc_Commands_defined
  30.    #include "cmddefs.xh"
  31. #endif
  32.  
  33. /*
  34.  *  The default routine which handles messages to the PM timer window.
  35.  */
  36. static PFNWP  frameProc;
  37.  
  38. #define double_t double
  39. #define ODFixedToFloat(a)  ((ODFixed)(a) / 65536.0)
  40. #define ODFloatToFixed(a)  ((ODFixed)((double_t)(a) * 65536.0))
  41. #define FIXED2LONG(f) (((f) + 0x8000) >> 16)
  42. #define RATE      150UL           // Initial scroll rate.
  43.  
  44. /*
  45.  *  The Ticker Tape 1 module name is defined for obtaining module
  46.  *  resources such as the default Ticker Tape text and error messages.
  47.  */
  48. #define MODULENAME    "TTAPE1.DLL"
  49.  
  50. /*
  51.  *  Ticker Tape 1 part storage unit properties.
  52.  */
  53. const ODPropertyName kODPropTickerTapeAttr  = "+//ISO 9070/ANSI::113722::US::CI LABS::IBM:TickerTape:Attributes";
  54.  
  55. /*
  56.  *  Ticker Tape 1 values types to add to the storage unit properties.
  57.  */
  58. const ODValueType kTickerTape1AttrType  = "+//ISO 9070/ANSI::113722::US::CI LABS::IBM:TickerTape1:Attributes";
  59. const ODValueType kTickerTape1TextType  = "+//ISO 9070/ANSI::113722::US::CI LABS::IBM:TickerTape1:Text";
  60.  
  61. /*
  62.  *  Ticker Tape 1 types for the OpenDoc registration process.
  63.  */
  64. const ODType    kPartHandlerName            = "TickerTape1Part";
  65. const ODType    kPartHandlerDisplayName     = "Ticker Tape 1 Part";
  66. const ODType    kKindTickerTape1Part        = "+//ISO 9070/ANSI::113722::US::CI LABS::IBM:TickerTape1Part:ttape1";
  67. const ODType    kTickerTape1KindDisplayName = "Ticker Tape 1 Kind";
  68. const ODType    kTickerTape1Category        = "text";
  69.  
  70. /*
  71.  *  Ticker Tape 1 constants.
  72.  */
  73. const unsigned MESSAGESIZE   =  60; /* Max size of a message string.     */
  74. const unsigned TTAPE1_HEIGHT =  40; /* Init height of Ticker Tape box.   */
  75. const unsigned TTAPE1_WIDTH  = 240; /* Init width of Ticker Tape box.    */
  76. const unsigned SMALLICONSIZE =  16; /* Length of one side of small icon. */
  77. const unsigned LARGEICONSIZE =  32; /* Length of one side of large icon. */
  78. const unsigned THUMBNAILSIZE =  64; /* Length of one side of thumbnail.  */
  79.  
  80. /*
  81.  *  Resource identifiers for selecting the Popup menu resource and
  82.  *  message resources from the message table resource.
  83.  */
  84. #define RESID_TOPMENU           100
  85. #define RESID_EDMENU            101
  86. #define RESID_ROOTMENU          102
  87. #define RESID_SELECTEDMENU      103
  88. #define RESID_WHENSELECTEDMENU  104
  89.  
  90. #define ID_POPUPMENU            105
  91. #define IDM_WELCOME             106
  92. #define IDM_OPENTEXTFILE        107
  93. #define IDM_ERROROPENING        108
  94. #define IDM_ERRORFILEINFO       109
  95. #define IDM_ERRORSIZEFILE       110
  96. #define IDM_ERRORREADING        111
  97. #define IDB_BMP1                112
  98.  
  99. #define IDMA_COLOR_BASE         MENUID_ACTIVEPART_USER
  100. #define IDMA_COLOR_GRAY          IDMA_COLOR_BASE+1
  101. #define IDMA_COLOR_RED           IDMA_COLOR_BASE+2
  102. #define IDMA_COLOR_GREEN         IDMA_COLOR_BASE+3
  103. #define IDMA_COLOR_YELLOW        IDMA_COLOR_BASE+4
  104. #define IDMA_COLOR_BLUE          IDMA_COLOR_BASE+5
  105. #define IDMA_COLOR_MAGENTA       IDMA_COLOR_BASE+6
  106. #define IDMA_COLOR_CYAN          IDMA_COLOR_BASE+7
  107. #define IDMA_COLOR_WHITE         IDMA_COLOR_BASE+8
  108.  
  109. #define IDMP_COLOR_BASE        MENUID_ACTIVEPART_USER +42
  110. #define IDMP_SHOWAS            MENUID_ACTIVEPART_USER +43
  111. #define IDMP_FILE_OPEN         MENUID_ACTIVEPART_USER +44
  112. #define IDMP_PRINT             MENUID_ACTIVEPART_USER +451
  113.  
  114. #define  IDMA_PRINT            MENUID_ACTIVEPART_FIRST + 202
  115. #define  IDMA_BACKGROUND       MENUID_ACTIVEPART_FIRST + 203
  116. #define  IDMA_FILENAME         MENUID_ACTIVEPART_FIRST + 204
  117.  
  118. /*
  119.  * The color the Container uses to draw itself.
  120.  */
  121. typedef long RGBColor;
  122.  
  123. /*
  124.  *  OpenDoc class utility for constructing an ODRectl object from a RECTL.
  125.  */
  126. class ODRECTL : public RECTL
  127. {
  128.    public:
  129.    operator ODRect() const { ODRect rct = {
  130.                                  MAKEFIXED(xLeft,0),
  131.                                  MAKEFIXED(yTop,0),
  132.                                  MAKEFIXED(xRight,0),
  133.                                  MAKEFIXED(yBottom,0)
  134.                                           }; return rct; } ;
  135.    ODRECTL( ODRect rct) {
  136.            xLeft   = FIXED2LONG(rct.left);
  137.            yBottom = FIXED2LONG(rct.bottom);
  138.            xRight  = FIXED2LONG(rct.right);
  139.            yTop    = FIXED2LONG(rct.top);
  140.                         };
  141.    ODRECTL( ODPoint botLeft, ODPoint topRight) {
  142.            xLeft   = FIXED2LONG(botLeft.x);
  143.            yBottom = FIXED2LONG(botLeft.y);
  144.            xRight  = FIXED2LONG(topRight.x);
  145.            yTop    = FIXED2LONG(topRight.y);
  146.                         };
  147.    ODRECTL( ) { xLeft = yBottom = xRight = yTop = 0; };
  148.    ODRECTL( RECTL & rct)  { *this = *(ODRECTL *)&rct ;}
  149. };
  150.  
  151. /*
  152.  *  Utility macro for releasing an OpenDoc ref-counted object.
  153.  */
  154. #define  ODReleaseObject(ev, object) \
  155.   do{                \
  156.     if (object!=kODNULL) {    \
  157.       object->Release(ev);  \
  158.       object = kODNULL;    \
  159.     }              \
  160.   }while(0)
  161.  
  162. #endif  // _TTAPE1_HPP_
  163.