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