home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / msinc.pak / RICHEDIT.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  12KB  |  499 lines

  1. /*
  2.  *    RICHEDIT.H
  3.  *    
  4.  *    Purpose:
  5.  *        RICHEDIT public definitions
  6.  *    
  7.  *    Copyright (c) 1985-1995, Microsoft Corporation
  8.  */
  9.  
  10. #ifndef _RICHEDIT_
  11. #define    _RICHEDIT_
  12.  
  13. #ifdef _WIN32
  14. #include <pshpack4.h>
  15. #elif !defined(RC_INVOKED)
  16. #pragma pack(4)
  17. #endif
  18.  
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif /* __cplusplus */
  22.  
  23. /*
  24.  *    To make some structures which can be passed between 16 and 32 bit windows
  25.  *    almost compatible, padding is introduced to the 16 bit versions of the
  26.  *    structure.
  27.  */
  28. #ifdef _WIN32
  29. #    define    _WPAD    /##/
  30. #else
  31. #    define    _WPAD    WORD
  32. #endif
  33.  
  34. #define cchTextLimitDefault 32767
  35.  
  36. /* RichEdit messages */
  37.  
  38. #ifndef WM_CONTEXTMENU
  39. #define WM_CONTEXTMENU            0x007B
  40. #endif
  41.  
  42. #ifndef WM_PRINTCLIENT
  43. #define WM_PRINTCLIENT            0x0318
  44. #endif
  45.  
  46. #ifndef EM_GETLIMITTEXT
  47. #define EM_GETLIMITTEXT            (WM_USER + 37)
  48. #endif
  49.  
  50. #ifndef EM_POSFROMCHAR    
  51. #define EM_POSFROMCHAR            (WM_USER + 38)
  52. #define EM_CHARFROMPOS            (WM_USER + 39)
  53. #endif
  54.  
  55. #ifndef EM_SCROLLCARET
  56. #define EM_SCROLLCARET            (WM_USER + 49)
  57. #endif
  58. #define EM_CANPASTE                (WM_USER + 50)
  59. #define EM_DISPLAYBAND            (WM_USER + 51)
  60. #define EM_EXGETSEL                (WM_USER + 52)
  61. #define EM_EXLIMITTEXT            (WM_USER + 53)
  62. #define EM_EXLINEFROMCHAR        (WM_USER + 54)
  63. #define EM_EXSETSEL                (WM_USER + 55)
  64. #define EM_FINDTEXT                (WM_USER + 56)
  65. #define EM_FORMATRANGE            (WM_USER + 57)
  66. #define EM_GETCHARFORMAT        (WM_USER + 58)
  67. #define EM_GETEVENTMASK            (WM_USER + 59)
  68. #define EM_GETOLEINTERFACE        (WM_USER + 60)
  69. #define EM_GETPARAFORMAT        (WM_USER + 61)
  70. #define EM_GETSELTEXT            (WM_USER + 62)
  71. #define EM_HIDESELECTION        (WM_USER + 63)
  72. #define EM_PASTESPECIAL            (WM_USER + 64)
  73. #define EM_REQUESTRESIZE        (WM_USER + 65)
  74. #define EM_SELECTIONTYPE        (WM_USER + 66)
  75. #define EM_SETBKGNDCOLOR        (WM_USER + 67)
  76. #define EM_SETCHARFORMAT        (WM_USER + 68)
  77. #define EM_SETEVENTMASK            (WM_USER + 69)
  78. #define EM_SETOLECALLBACK        (WM_USER + 70)
  79. #define EM_SETPARAFORMAT        (WM_USER + 71)
  80. #define EM_SETTARGETDEVICE        (WM_USER + 72)
  81. #define EM_STREAMIN                (WM_USER + 73)
  82. #define EM_STREAMOUT            (WM_USER + 74)
  83. #define EM_GETTEXTRANGE            (WM_USER + 75)
  84. #define EM_FINDWORDBREAK        (WM_USER + 76)
  85. #define EM_SETOPTIONS            (WM_USER + 77)
  86. #define EM_GETOPTIONS            (WM_USER + 78)
  87. #define EM_FINDTEXTEX            (WM_USER + 79)
  88. #ifdef _WIN32
  89. #define EM_GETWORDBREAKPROCEX    (WM_USER + 80)
  90. #define EM_SETWORDBREAKPROCEX    (WM_USER + 81)
  91. #endif
  92.  
  93. /* Far East specific messages */
  94. #define EM_SETPUNCTUATION        (WM_USER + 100)
  95. #define EM_GETPUNCTUATION        (WM_USER + 101)
  96. #define EM_SETWORDWRAPMODE        (WM_USER + 102)
  97. #define EM_GETWORDWRAPMODE        (WM_USER + 103)
  98. #define EM_SETIMECOLOR            (WM_USER + 104)
  99. #define EM_GETIMECOLOR            (WM_USER + 105)
  100. #define EM_SETIMEOPTIONS        (WM_USER + 106)
  101. #define EM_GETIMEOPTIONS        (WM_USER + 107)
  102.  
  103.  
  104. /* new notifications */
  105.  
  106. #define EN_MSGFILTER            0x0700
  107. #define EN_REQUESTRESIZE        0x0701
  108. #define EN_SELCHANGE            0x0702
  109. #define EN_DROPFILES            0x0703
  110. #define EN_PROTECTED            0x0704
  111. /* PenWin specific */
  112. #define EN_CORRECTTEXT            0x0705
  113. /* back to new notifications */
  114. #define EN_STOPNOUNDO            0x0706
  115. /* Far East specific notification */
  116. #define EN_IMECHANGE            0x0707
  117. /* back to new notifications */
  118. #define EN_SAVECLIPBOARD        0x0708
  119. #define EN_OLEOPFAILED            0x0709
  120.  
  121. /* event notification masks */
  122.  
  123. #define ENM_NONE                0x00000000
  124. #define ENM_CHANGE                0x00000001
  125. #define ENM_UPDATE                0x00000002
  126. #define ENM_SCROLL                0x00000004
  127. #define ENM_KEYEVENTS            0x00010000
  128. #define ENM_MOUSEEVENTS            0x00020000
  129. #define ENM_REQUESTRESIZE        0x00040000
  130. #define ENM_SELCHANGE            0x00080000
  131. #define ENM_DROPFILES            0x00100000
  132. #define ENM_PROTECTED            0x00200000
  133. /* PenWin specific */
  134. #define ENM_CORRECTTEXT            0x00400000
  135. /* Far East specific notification mask */
  136. #define ENM_IMECHANGE            0x00800000
  137.  
  138. /* new edit control styles */
  139.  
  140. #define ES_SAVESEL                0x00008000
  141. #define ES_SUNKEN                0x00004000
  142. #define ES_DISABLENOSCROLL        0x00002000
  143. /* same as WS_MAXIMIZE, but that doesn't make sense so we re-use the value */
  144. #define ES_SELECTIONBAR            0x01000000
  145.  
  146. /* new edit control extended style */
  147. #ifdef    _WIN32
  148. #define ES_EX_NOCALLOLEINIT        0x01000000
  149. #endif    
  150.  
  151. /* These flag are used in the only FE Windows. */
  152. #define ES_VERTICAL                0x00400000
  153. #define    ES_NOIME                0x00080000
  154. #define ES_SELFIME                0x00040000
  155.  
  156. /* edit control options */
  157. #define ECO_AUTOWORDSELECTION    0x00000001
  158. #define ECO_AUTOVSCROLL            0x00000040
  159. #define ECO_AUTOHSCROLL            0x00000080
  160. #define ECO_NOHIDESEL            0x00000100
  161. #define ECO_READONLY            0x00000800
  162. #define ECO_WANTRETURN            0x00001000
  163. #define ECO_SAVESEL                0x00008000
  164. #define ECO_SELECTIONBAR        0x01000000
  165. /* used only in FE Windows version */
  166. #define ECO_VERTICAL            0x00400000
  167.  
  168. /* ECO operations */
  169. #define ECOOP_SET                0x0001
  170. #define ECOOP_OR                0x0002
  171. #define ECOOP_AND                0x0003
  172. #define ECOOP_XOR                0x0004
  173.  
  174. /* new word break function actions */
  175. #define WB_CLASSIFY            3
  176. #define WB_MOVEWORDLEFT        4
  177. #define WB_MOVEWORDRIGHT    5
  178. #define WB_LEFTBREAK        6
  179. #define WB_RIGHTBREAK        7
  180.  
  181. /* Far East specific flags */
  182. #define WB_MOVEWORDPREV        4
  183. #define WB_MOVEWORDNEXT        5
  184. #define WB_PREVBREAK        6
  185. #define WB_NEXTBREAK        7
  186.  
  187.  
  188. #define PC_FOLLOWING        1
  189. #define    PC_LEADING            2
  190. #define    PC_OVERFLOW            3
  191. #define    PC_DELIMITER        4
  192. #define WBF_WORDWRAP        0x010
  193. #define WBF_WORDBREAK        0x020
  194. #define    WBF_OVERFLOW        0x040    
  195. #define WBF_LEVEL1            0x080
  196. #define    WBF_LEVEL2            0x100
  197. #define    WBF_CUSTOM            0x200
  198.  
  199. /* Far East specific flags */
  200. #define IMF_FORCENONE            0x0001
  201. #define    IMF_FORCEENABLE            0x0002
  202. #define IMF_FORCEDISABLE        0x0004
  203. #define IMF_CLOSESTATUSWINDOW    0x0008
  204. #define    IMF_VERTICAL            0x0020
  205. #define IMF_FORCEACTIVE            0x0040
  206. #define IMF_FORCEINACTIVE        0x0080
  207. #define IMF_FORCEREMEMBER        0x0100
  208.  
  209.  
  210. /* word break flags (used with WB_CLASSIFY) */
  211. #define WBF_CLASS            ((BYTE) 0x0F)
  212. #define WBF_ISWHITE            ((BYTE) 0x10)
  213. #define WBF_BREAKLINE        ((BYTE) 0x20)
  214. #define WBF_BREAKAFTER        ((BYTE) 0x40)
  215.  
  216.  
  217. /* new data types */
  218.  
  219. #ifdef _WIN32
  220. /* extended edit word break proc (character set aware) */
  221. typedef LONG (*EDITWORDBREAKPROCEX)(char *pchText, LONG cchText, BYTE bCharSet, INT action);
  222. #endif
  223.  
  224. /* all character format measurements are in twips */
  225. typedef struct _charformat
  226. {
  227.     UINT        cbSize;
  228.     _WPAD        _wPad1;
  229.     DWORD        dwMask;
  230.     DWORD        dwEffects;
  231.     LONG        yHeight;
  232.     LONG        yOffset;            /* > 0 for superscript, < 0 for subscript */
  233.     COLORREF    crTextColor;
  234.     BYTE        bCharSet;
  235.     BYTE        bPitchAndFamily;
  236.     TCHAR        szFaceName[LF_FACESIZE];
  237.     _WPAD        _wPad2;
  238. } CHARFORMAT;
  239.  
  240. /* CHARFORMAT masks */
  241. #define CFM_BOLD        0x00000001
  242. #define CFM_ITALIC        0x00000002
  243. #define CFM_UNDERLINE    0x00000004
  244. #define CFM_STRIKEOUT    0x00000008
  245. #define CFM_PROTECTED    0x00000010
  246. #define CFM_SIZE        0x80000000
  247. #define CFM_COLOR        0x40000000
  248. #define CFM_FACE        0x20000000
  249. #define CFM_OFFSET        0x10000000
  250. #define CFM_CHARSET        0x08000000
  251.  
  252. /* CHARFORMAT effects */
  253. #define CFE_BOLD        0x0001
  254. #define CFE_ITALIC        0x0002
  255. #define CFE_UNDERLINE    0x0004
  256. #define CFE_STRIKEOUT    0x0008
  257. #define CFE_PROTECTED    0x0010
  258. /* NOTE: CFE_AUTOCOLOR corresponds to CFM_COLOR, which controls it */
  259. #define CFE_AUTOCOLOR    0x40000000
  260.  
  261. #define yHeightCharPtsMost 1638
  262.  
  263. /* EM_SETCHARFORMAT wParam masks */
  264. #define SCF_SELECTION    0x0001
  265. #define SCF_WORD        0x0002
  266.  
  267. typedef struct _charrange
  268. {
  269.     LONG    cpMin;
  270.     LONG    cpMax;
  271. } CHARRANGE;
  272.  
  273. typedef struct _textrange
  274. {
  275.     CHARRANGE chrg;
  276.     LPSTR lpstrText;    /* allocated by caller, zero terminated by RichEdit */
  277. } TEXTRANGE;
  278.  
  279. typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
  280.  
  281. typedef struct _editstream
  282. {
  283.     DWORD dwCookie;        /* user value passed to callback as first parameter */
  284.     DWORD dwError;        /* last error */
  285.     EDITSTREAMCALLBACK pfnCallback;
  286. } EDITSTREAM;
  287.  
  288. /* stream formats */
  289.  
  290. #define SF_TEXT            0x0001
  291. #define SF_RTF            0x0002
  292. #define SF_RTFNOOBJS    0x0003        /* outbound only */
  293. #define SF_TEXTIZED        0x0004        /* outbound only */
  294.  
  295. /* Flag telling stream operations to operate on the selection only */
  296. /* EM_STREAMIN will replace the current selection */
  297. /* EM_STREAMOUT will stream out the current selection */
  298. #define SFF_SELECTION    0x8000
  299.  
  300. /* Flag telling stream operations to operate on the common RTF keyword only */
  301. /* EM_STREAMIN will accept the only common RTF keyword */
  302. /* EM_STREAMOUT will stream out the only common RTF keyword */
  303. #define SFF_PLAINRTF    0x4000
  304.  
  305. typedef struct _findtext
  306. {
  307.     CHARRANGE chrg;
  308.     LPSTR lpstrText;
  309. } FINDTEXT;
  310.  
  311. typedef struct _findtextex
  312. {
  313.     CHARRANGE chrg;
  314.     LPSTR lpstrText;
  315.     CHARRANGE chrgText;
  316. } FINDTEXTEX;
  317.  
  318. typedef struct _formatrange
  319. {
  320.     HDC hdc;
  321.     HDC hdcTarget;
  322.     RECT rc;
  323.     RECT rcPage;
  324.     CHARRANGE chrg;
  325. } FORMATRANGE;
  326.  
  327. /* all paragraph measurements are in twips */
  328.  
  329. #define MAX_TAB_STOPS 32
  330. #define lDefaultTab 720
  331.  
  332. typedef struct _paraformat
  333. {
  334.     UINT    cbSize;
  335.     _WPAD    _wPad1;
  336.     DWORD    dwMask;
  337.     WORD    wNumbering;
  338.     WORD    wReserved;
  339.     LONG    dxStartIndent;
  340.     LONG    dxRightIndent;
  341.     LONG    dxOffset;
  342.     WORD    wAlignment;
  343.     SHORT    cTabCount;
  344.     LONG    rgxTabs[MAX_TAB_STOPS];
  345. } PARAFORMAT;
  346.  
  347. /* PARAFORMAT mask values */
  348. #define PFM_STARTINDENT            0x00000001
  349. #define PFM_RIGHTINDENT            0x00000002
  350. #define PFM_OFFSET                0x00000004
  351. #define PFM_ALIGNMENT            0x00000008
  352. #define PFM_TABSTOPS            0x00000010
  353. #define PFM_NUMBERING            0x00000020
  354. #define PFM_OFFSETINDENT        0x80000000
  355.  
  356. /* PARAFORMAT numbering options */
  357. #define PFN_BULLET        0x0001
  358.  
  359. /* PARAFORMAT alignment options */
  360. #define PFA_LEFT    0x0001
  361. #define PFA_RIGHT    0x0002
  362. #define PFA_CENTER    0x0003
  363.  
  364. /* notification structures */
  365.  
  366. #ifndef WM_NOTIFY
  367. #define WM_NOTIFY                0x004E
  368.  
  369. typedef struct _nmhdr
  370. {
  371.     HWND    hwndFrom;
  372.     _WPAD    _wPad1;
  373.     UINT    idFrom;
  374.     _WPAD    _wPad2;
  375.     UINT    code;
  376.     _WPAD    _wPad3;
  377. } NMHDR;
  378. #endif  /* !WM_NOTIFY */
  379.  
  380. typedef struct _msgfilter
  381. {
  382.     NMHDR    nmhdr;
  383.     UINT    msg;
  384.     _WPAD    _wPad1;
  385.     WPARAM    wParam;
  386.     _WPAD    _wPad2;
  387.     LPARAM    lParam;
  388. } MSGFILTER;
  389.  
  390. typedef struct _reqresize
  391. {
  392.     NMHDR nmhdr;
  393.     RECT rc;
  394. } REQRESIZE;
  395.  
  396. typedef struct _selchange
  397. {
  398.     NMHDR nmhdr;
  399.     CHARRANGE chrg;
  400.     WORD seltyp;
  401. } SELCHANGE;
  402.  
  403. #define SEL_EMPTY        0x0000
  404. #define SEL_TEXT        0x0001
  405. #define SEL_OBJECT        0x0002
  406. #define SEL_MULTICHAR    0x0004
  407. #define SEL_MULTIOBJECT    0x0008
  408.  
  409. typedef struct _endropfiles
  410. {
  411.     NMHDR nmhdr;
  412.     HANDLE hDrop;
  413.     LONG cp;
  414.     BOOL fProtected;
  415. } ENDROPFILES;
  416.  
  417. typedef struct _enprotected
  418. {
  419.     NMHDR nmhdr;
  420.     UINT msg;
  421.     _WPAD    _wPad1;
  422.     WPARAM wParam;
  423.     _WPAD    _wPad2;
  424.     LPARAM lParam;
  425.     CHARRANGE chrg;
  426. } ENPROTECTED;
  427.  
  428. typedef struct _ensaveclipboard
  429. {
  430.     NMHDR nmhdr;
  431.     LONG cObjectCount;
  432.     LONG cch;
  433. } ENSAVECLIPBOARD;
  434.  
  435. typedef struct _enoleopfailed
  436. {
  437.     NMHDR nmhdr;
  438.     LONG iob;
  439.     LONG lOper;
  440.     HRESULT hr;
  441. } ENOLEOPFAILED;
  442.  
  443. #define    OLEOP_DOVERB    1
  444.  
  445. /* PenWin specific */
  446. typedef struct _encorrecttext
  447. {
  448.     NMHDR nmhdr;
  449.     CHARRANGE chrg;
  450.     WORD seltyp;
  451. } ENCORRECTTEXT;
  452.  
  453. /* Far East specific */
  454. typedef struct _punctuation
  455. {
  456.     UINT    iSize;
  457.     LPSTR    szPunctuation;
  458. } PUNCTUATION;
  459.  
  460. /* Far East specific */
  461. typedef struct _compcolor
  462. {
  463.     COLORREF crText;
  464.     COLORREF crBackground;
  465.     DWORD dwEffects;
  466. }COMPCOLOR;
  467.  
  468.  
  469. /* clipboard formats - use as parameter to RegisterClipboardFormat() */
  470. #define CF_RTF "Rich Text Format"
  471. #define CF_RTFNOOBJS "Rich Text Format Without Objects"
  472. #define CF_RETEXTOBJ "RichEdit Text and Objects"
  473.  
  474. /* Paste Special */
  475. typedef struct _repastespecial
  476. {
  477.     DWORD    dwAspect;
  478.     DWORD    dwParam;
  479. } REPASTESPECIAL;
  480.  
  481. #ifdef MAC
  482. BOOL WINAPI EntryFunc_RICHEDIT(HMODULE hmod, DWORD dwReason, LPVOID lpvReserved);
  483. #endif
  484.  
  485. #undef _WPAD
  486.  
  487. #ifdef _WIN32
  488. #include <poppack.h>
  489. #elif !defined(RC_INVOKED)
  490. #pragma pack()
  491. #endif
  492.  
  493. #ifdef __cplusplus
  494. }
  495. #endif  /* __cplusplus */
  496.  
  497. #endif /* !_RICHEDIT_ */
  498.  
  499.