1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7  * Source: $(DRUNTIMESRC core/sys/windows/_richedit.d)
8  */
9 module core.sys.windows.richedit;
10 version (Windows):
11 
12 version (ANSI) {} else version = Unicode;
13 
14 import core.sys.windows.windef, core.sys.windows.winuser;
15 import core.sys.windows.wingdi; // for LF_FACESIZE
16 
17 align(4):
18 
19 version (Unicode) {
20 const wchar[] RICHEDIT_CLASS = "RichEdit20W";
21 } else {
22 const char[] RICHEDIT_CLASS  = "RichEdit20A";
23 }
24 
25 enum RICHEDIT_CLASS10A = "RICHEDIT";
26 
27 const TCHAR[]
28     CF_RTF       = "Rich Text Format",
29     CF_RTFNOOBJS = "Rich Text Format Without Objects",
30     CF_RETEXTOBJ = "RichEdit Text and Objects";
31 
32 enum DWORD
33     CFM_BOLD        = 1,
34     CFM_ITALIC      = 2,
35     CFM_UNDERLINE   = 4,
36     CFM_STRIKEOUT   = 8,
37     CFM_PROTECTED   = 16,
38     CFM_LINK        = 32,
39     CFM_SIZE        = 0x80000000,
40     CFM_COLOR       = 0x40000000,
41     CFM_FACE        = 0x20000000,
42     CFM_OFFSET      = 0x10000000,
43     CFM_CHARSET     = 0x08000000,
44     CFM_SUBSCRIPT   = 0x00030000,
45     CFM_SUPERSCRIPT = 0x00030000;
46 
47 enum DWORD
48     CFE_BOLD        = 1,
49     CFE_ITALIC      = 2,
50     CFE_UNDERLINE   = 4,
51     CFE_STRIKEOUT   = 8,
52     CFE_PROTECTED   = 16,
53     CFE_SUBSCRIPT   = 0x00010000,
54     CFE_SUPERSCRIPT = 0x00020000,
55     CFE_AUTOCOLOR   = 0x40000000;
56 
57 enum CFM_EFFECTS = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR
58   | CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK;
59 
60 // flags for EM_SETIMEOPTIONS
61 enum LPARAM
62     IMF_FORCENONE         = 1,
63     IMF_FORCEENABLE       = 2,
64     IMF_FORCEDISABLE      = 4,
65     IMF_CLOSESTATUSWINDOW = 8,
66     IMF_VERTICAL          = 32,
67     IMF_FORCEACTIVE       = 64,
68     IMF_FORCEINACTIVE     = 128,
69     IMF_FORCEREMEMBER     = 256;
70 
71 enum SEL_EMPTY=0;
72 enum SEL_TEXT=1;
73 enum SEL_OBJECT=2;
74 enum SEL_MULTICHAR=4;
75 enum SEL_MULTIOBJECT=8;
76 
77 enum MAX_TAB_STOPS=32;
78 
79 enum PFM_ALIGNMENT=8;
80 enum PFM_NUMBERING=32;
81 enum PFM_OFFSET=4;
82 enum PFM_OFFSETINDENT=0x80000000;
83 enum PFM_RIGHTINDENT=2;
84 enum PFM_STARTINDENT=1;
85 enum PFM_TABSTOPS=16;
86 enum PFM_BORDER=2048;
87 enum PFM_LINESPACING=256;
88 enum PFM_NUMBERINGSTART=32768;
89 enum PFM_NUMBERINGSTYLE=8192;
90 enum PFM_NUMBERINGTAB=16384;
91 enum PFM_SHADING=4096;
92 enum PFM_SPACEAFTER=128;
93 enum PFM_SPACEBEFORE=64;
94 enum PFM_STYLE=1024;
95 enum PFM_DONOTHYPHEN=4194304;
96 enum PFM_KEEP=131072;
97 enum PFM_KEEPNEXT=262144;
98 enum PFM_NOLINENUMBER=1048576;
99 enum PFM_NOWIDOWCONTROL=2097152;
100 enum PFM_PAGEBREAKBEFORE=524288;
101 enum PFM_RTLPARA=65536;
102 enum PFM_SIDEBYSIDE=8388608;
103 enum PFM_TABLE=1073741824;
104 enum PFN_BULLET=1;
105 
106 enum PFE_DONOTHYPHEN=64;
107 enum PFE_KEEP=2;
108 enum PFE_KEEPNEXT=4;
109 enum PFE_NOLINENUMBER=16;
110 enum PFE_NOWIDOWCONTROL=32;
111 enum PFE_PAGEBREAKBEFORE=8;
112 enum PFE_RTLPARA=1;
113 enum PFE_SIDEBYSIDE=128;
114 enum PFE_TABLE=16384;
115 enum PFA_LEFT=1;
116 enum PFA_RIGHT=2;
117 enum PFA_CENTER=3;
118 enum PFA_JUSTIFY=4;
119 enum PFA_FULL_INTERWORD=4;
120 
121 enum SF_TEXT=1;
122 enum SF_RTF=2;
123 enum SF_RTFNOOBJS=3;
124 enum SF_TEXTIZED=4;
125 enum SF_UNICODE=16;
126 enum SF_USECODEPAGE=32;
127 enum SF_NCRFORNONASCII=64;
128 enum SF_RTFVAL=0x0700;
129 
130 enum SFF_PWD=0x0800;
131 enum SFF_KEEPDOCINFO=0x1000;
132 enum SFF_PERSISTVIEWSCALE=0x2000;
133 enum SFF_PLAINRTF=0x4000;
134 enum SFF_SELECTION=0x8000;
135 
136 enum WB_CLASSIFY      = 3;
137 enum WB_MOVEWORDLEFT  = 4;
138 enum WB_MOVEWORDRIGHT = 5;
139 enum WB_LEFTBREAK     = 6;
140 enum WB_RIGHTBREAK    = 7;
141 enum WB_MOVEWORDPREV  = 4;
142 enum WB_MOVEWORDNEXT  = 5;
143 enum WB_PREVBREAK     = 6;
144 enum WB_NEXTBREAK     = 7;
145 
146 enum WBF_WORDWRAP  = 16;
147 enum WBF_WORDBREAK = 32;
148 enum WBF_OVERFLOW  = 64;
149 enum WBF_LEVEL1    = 128;
150 enum WBF_LEVEL2    = 256;
151 enum WBF_CUSTOM    = 512;
152 
153 enum ES_DISABLENOSCROLL  = 8192;
154 enum ES_SUNKEN           = 16384;
155 enum ES_SAVESEL          = 32768;
156 enum ES_EX_NOCALLOLEINIT = 16777216;
157 enum ES_NOIME            = 524288;
158 enum ES_NOOLEDRAGDROP    = 8;
159 enum ES_SELECTIONBAR     = 16777216;
160 enum ES_SELFIME          = 262144;
161 enum ES_VERTICAL         = 4194304;
162 
163 enum EM_CANPASTE = WM_USER+50;
164 enum EM_DISPLAYBAND = WM_USER+51;
165 enum EM_EXGETSEL = WM_USER+52;
166 enum EM_EXLIMITTEXT = WM_USER+53;
167 enum EM_EXLINEFROMCHAR = WM_USER+54;
168 enum EM_EXSETSEL = WM_USER+55;
169 enum EM_FINDTEXT = WM_USER+56;
170 enum EM_FORMATRANGE = WM_USER+57;
171 enum EM_GETCHARFORMAT = WM_USER+58;
172 enum EM_GETEVENTMASK = WM_USER+59;
173 enum EM_GETOLEINTERFACE = WM_USER+60;
174 enum EM_GETPARAFORMAT = WM_USER+61;
175 enum EM_GETSELTEXT = WM_USER+62;
176 enum EM_HIDESELECTION = WM_USER+63;
177 enum EM_PASTESPECIAL = WM_USER+64;
178 enum EM_REQUESTRESIZE = WM_USER+65;
179 enum EM_SELECTIONTYPE = WM_USER+66;
180 enum EM_SETBKGNDCOLOR = WM_USER+67;
181 enum EM_SETCHARFORMAT = WM_USER+68;
182 enum EM_SETEVENTMASK = WM_USER+69;
183 enum EM_SETOLECALLBACK = WM_USER+70;
184 enum EM_SETPARAFORMAT = WM_USER+71;
185 enum EM_SETTARGETDEVICE = WM_USER+72;
186 enum EM_STREAMIN = WM_USER+73;
187 enum EM_STREAMOUT = WM_USER+74;
188 enum EM_GETTEXTRANGE = WM_USER+75;
189 enum EM_FINDWORDBREAK = WM_USER+76;
190 enum EM_SETOPTIONS = WM_USER+77;
191 enum EM_GETOPTIONS = WM_USER+78;
192 enum EM_FINDTEXTEX = WM_USER+79;
193 enum EM_GETWORDBREAKPROCEX = WM_USER+80;
194 enum EM_SETWORDBREAKPROCEX = WM_USER+81;
195 /* RichEdit 2.0 messages */
196 enum EM_SETUNDOLIMIT = WM_USER+82;
197 enum EM_REDO = WM_USER+84;
198 enum EM_CANREDO = WM_USER+85;
199 enum EM_GETUNDONAME = WM_USER+86;
200 enum EM_GETREDONAME = WM_USER+87;
201 enum EM_STOPGROUPTYPING = WM_USER+88;
202 enum EM_SETTEXTMODE = WM_USER+89;
203 enum EM_GETTEXTMODE = WM_USER+90;
204 enum EM_AUTOURLDETECT = WM_USER+91;
205 enum EM_GETAUTOURLDETECT = WM_USER + 92;
206 enum EM_SETPALETTE = WM_USER + 93;
207 enum EM_GETTEXTEX = WM_USER+94;
208 enum EM_GETTEXTLENGTHEX = WM_USER+95;
209 enum EM_SHOWSCROLLBAR = WM_USER+96;
210 enum EM_SETTEXTEX = WM_USER + 97;
211 enum EM_SETPUNCTUATION = WM_USER + 100;
212 enum EM_GETPUNCTUATION = WM_USER + 101;
213 enum EM_SETWORDWRAPMODE = WM_USER + 102;
214 enum EM_GETWORDWRAPMODE = WM_USER + 103;
215 enum EM_SETIMECOLOR = WM_USER + 104;
216 enum EM_GETIMECOLOR = WM_USER + 105;
217 enum EM_SETIMEOPTIONS = WM_USER + 106;
218 enum EM_GETIMEOPTIONS = WM_USER + 107;
219 enum EM_SETLANGOPTIONS = WM_USER+120;
220 enum EM_GETLANGOPTIONS = WM_USER+121;
221 enum EM_GETIMECOMPMODE = WM_USER+122;
222 enum EM_FINDTEXTW = WM_USER + 123;
223 enum EM_FINDTEXTEXW = WM_USER + 124;
224 enum EM_RECONVERSION = WM_USER + 125;
225 enum EM_SETBIDIOPTIONS = WM_USER + 200;
226 enum EM_GETBIDIOPTIONS = WM_USER + 201;
227 enum EM_SETTYPOGRAPHYOPTIONS = WM_USER+202;
228 enum EM_GETTYPOGRAPHYOPTIONS = WM_USER+203;
229 enum EM_SETEDITSTYLE = WM_USER + 204;
230 enum EM_GETEDITSTYLE = WM_USER + 205;
231 enum EM_GETSCROLLPOS = WM_USER+221;
232 enum EM_SETSCROLLPOS = WM_USER+222;
233 enum EM_SETFONTSIZE = WM_USER+223;
234 enum EM_GETZOOM = WM_USER+224;
235 enum EM_SETZOOM = WM_USER+225;
236 
237 enum EN_MSGFILTER     = 1792;
238 enum EN_REQUESTRESIZE = 1793;
239 enum EN_SELCHANGE     = 1794;
240 enum EN_DROPFILES     = 1795;
241 enum EN_PROTECTED     = 1796;
242 enum EN_CORRECTTEXT   = 1797;
243 enum EN_STOPNOUNDO    = 1798;
244 enum EN_IMECHANGE     = 1799;
245 enum EN_SAVECLIPBOARD = 1800;
246 enum EN_OLEOPFAILED   = 1801;
247 enum EN_LINK          = 1803;
248 
249 enum ENM_NONE            = 0;
250 enum ENM_CHANGE          = 1;
251 enum ENM_UPDATE          = 2;
252 enum ENM_SCROLL          = 4;
253 enum ENM_SCROLLEVENTS    = 8;
254 enum ENM_DRAGDROPDONE    = 16;
255 enum ENM_KEYEVENTS       = 65536;
256 enum ENM_MOUSEEVENTS     = 131072;
257 enum ENM_REQUESTRESIZE   = 262144;
258 enum ENM_SELCHANGE       = 524288;
259 enum ENM_DROPFILES       = 1048576;
260 enum ENM_PROTECTED       = 2097152;
261 enum ENM_CORRECTTEXT     = 4194304;
262 enum ENM_IMECHANGE       = 8388608;
263 enum ENM_LANGCHANGE      = 16777216;
264 enum ENM_OBJECTPOSITIONS = 33554432;
265 enum ENM_LINK            = 67108864;
266 
267 enum ECO_AUTOWORDSELECTION=1;
268 enum ECO_AUTOVSCROLL=64;
269 enum ECO_AUTOHSCROLL=128;
270 enum ECO_NOHIDESEL=256;
271 enum ECO_READONLY=2048;
272 enum ECO_WANTRETURN=4096;
273 enum ECO_SAVESEL=0x8000;
274 enum ECO_SELECTIONBAR=0x1000000;
275 enum ECO_VERTICAL=0x400000;
276 
277 enum {
278     ECOOP_SET = 1,
279     ECOOP_OR,
280     ECOOP_AND,
281     ECOOP_XOR
282 }
283 
284 enum SCF_DEFAULT    = 0;
285 enum SCF_SELECTION  = 1;
286 enum SCF_WORD       = 2;
287 enum SCF_ALL        = 4;
288 enum SCF_USEUIRULES = 8;
289 
290 alias DWORD TEXTMODE;
291 enum TM_PLAINTEXT=1;
292 enum TM_RICHTEXT=2;
293 enum TM_SINGLELEVELUNDO=4;
294 enum TM_MULTILEVELUNDO=8;
295 enum TM_SINGLECODEPAGE=16;
296 enum TM_MULTICODEPAGE=32;
297 
298 enum GT_DEFAULT=0;
299 enum GT_USECRLF=1;
300 
301 enum yHeightCharPtsMost=1638;
302 enum lDefaultTab=720;
303 
304 alias DWORD UNDONAMEID;
305 enum UID_UNKNOWN    = 0;
306 enum UID_TYPING     = 1;
307 enum UID_DELETE     = 2;
308 enum UID_DRAGDROP   = 3;
309 enum UID_CUT        = 4;
310 enum UID_PASTE      = 5;
311 
312 struct CHARFORMATA {
313     UINT cbSize = this.sizeof;
314     DWORD dwMask;
315     DWORD dwEffects;
316     LONG yHeight;
317     LONG yOffset;
318     COLORREF crTextColor;
319     BYTE bCharSet;
320     BYTE bPitchAndFamily;
321     char[LF_FACESIZE] szFaceName = 0;
322 }
323 struct CHARFORMATW {
324     UINT cbSize = this.sizeof;
325     DWORD dwMask;
326     DWORD dwEffects;
327     LONG yHeight;
328     LONG yOffset;
329     COLORREF crTextColor;
330     BYTE bCharSet;
331     BYTE bPitchAndFamily;
332     WCHAR[LF_FACESIZE] szFaceName = 0;
333 }
334 
335 struct CHARFORMAT2A {
336     UINT cbSize = this.sizeof;
337     DWORD dwMask;
338     DWORD dwEffects;
339     LONG yHeight;
340     LONG yOffset;
341     COLORREF crTextColor;
342     BYTE bCharSet;
343     BYTE bPitchAndFamily;
344     char[LF_FACESIZE] szFaceName = 0;
345     WORD wWeight;
346     SHORT sSpacing;
347     COLORREF crBackColor;
348     LCID lcid;
349     DWORD dwReserved;
350     SHORT sStyle;
351     WORD wKerning;
352     BYTE bUnderlineType;
353     BYTE bAnimation;
354     BYTE bRevAuthor;
355 }
356 
357 struct CHARFORMAT2W {
358     UINT cbSize = this.sizeof;
359     DWORD dwMask;
360     DWORD dwEffects;
361     LONG yHeight;
362     LONG yOffset;
363     COLORREF crTextColor;
364     BYTE bCharSet;
365     BYTE bPitchAndFamily;
366     WCHAR[LF_FACESIZE] szFaceName = 0;
367     WORD wWeight;
368     SHORT sSpacing;
369     COLORREF crBackColor;
370     LCID lcid;
371     DWORD dwReserved;
372     SHORT sStyle;
373     WORD wKerning;
374     BYTE bUnderlineType;
375     BYTE bAnimation;
376     BYTE bRevAuthor;
377 }
378 
379 struct CHARRANGE {
380     LONG cpMin;
381     LONG cpMax;
382 }
383 
384 struct COMPCOLOR {
385     COLORREF crText;
386     COLORREF crBackground;
387     DWORD dwEffects;
388 }
389 
390 extern (Windows) {
391     alias DWORD function(DWORD_PTR,PBYTE,LONG,LONG*) EDITSTREAMCALLBACK;
392 }
393 
394 struct EDITSTREAM {
395 align(4):
396     DWORD_PTR dwCookie;
397     DWORD dwError;
398     EDITSTREAMCALLBACK pfnCallback;
399 }
400 
401 struct ENCORRECTTEXT {
402 align(4):
403     NMHDR nmhdr;
404     CHARRANGE chrg;
405     WORD seltyp;
406 }
407 
408 struct ENDROPFILES {
409 align(4):
410     NMHDR nmhdr;
411     HANDLE hDrop;
412     LONG cp;
413     BOOL fProtected;
414 }
415 
416 struct ENLINK {
417 align(4):
418     NMHDR nmhdr;
419     UINT msg;
420     WPARAM wParam;
421     LPARAM lParam;
422     CHARRANGE chrg;
423 }
424 
425 struct ENOLEOPFAILED {
426 align(4):
427     NMHDR nmhdr;
428     LONG iob;
429     LONG lOper;
430     HRESULT hr;
431 }
432 
433 struct ENPROTECTED {
434 align(4):
435     NMHDR nmhdr;
436     UINT msg;
437     WPARAM wParam;
438     LPARAM lParam;
439     CHARRANGE chrg;
440 }
441 alias ENPROTECTED* LPENPROTECTED;
442 
443 struct ENSAVECLIPBOARD {
444 align(4):
445     NMHDR nmhdr;
446     LONG cObjectCount;
447     LONG cch;
448 }
449 
450 struct FINDTEXTA {
451     CHARRANGE chrg;
452     LPSTR lpstrText;
453 }
454 
455 struct FINDTEXTW {
456     CHARRANGE chrg;
457     LPWSTR lpstrText;
458 }
459 
460 struct FINDTEXTEXA {
461     CHARRANGE chrg;
462     LPSTR lpstrText;
463     CHARRANGE chrgText;
464 }
465 
466 struct FINDTEXTEXW {
467     CHARRANGE chrg;
468     LPWSTR lpstrText;
469     CHARRANGE chrgText;
470 }
471 
472 struct FORMATRANGE {
473     HDC hdc;
474     HDC hdcTarget;
475     RECT rc;
476     RECT rcPage;
477     CHARRANGE chrg;
478 }
479 
480 struct MSGFILTER {
481 align(4):
482     NMHDR nmhdr;
483     UINT msg;
484     WPARAM wParam;
485     LPARAM lParam;
486 }
487 
488 struct PARAFORMAT {
489     UINT cbSize = this.sizeof;
490     DWORD dwMask;
491     WORD wNumbering;
492     WORD wReserved;
493     LONG dxStartIndent;
494     LONG dxRightIndent;
495     LONG dxOffset;
496     WORD wAlignment;
497     SHORT cTabCount;
498     LONG[MAX_TAB_STOPS] rgxTabs;
499 }
500 
501 struct PARAFORMAT2 {
502     UINT cbSize = this.sizeof;
503     DWORD dwMask;
504     WORD wNumbering;
505     WORD wEffects;
506     LONG dxStartIndent;
507     LONG dxRightIndent;
508     LONG dxOffset;
509     WORD wAlignment;
510     SHORT cTabCount;
511     LONG[MAX_TAB_STOPS] rgxTabs;
512     LONG dySpaceBefore;
513     LONG dySpaceAfter;
514     LONG dyLineSpacing;
515     SHORT sStype;
516     BYTE bLineSpacingRule;
517     BYTE bOutlineLevel;
518     WORD wShadingWeight;
519     WORD wShadingStyle;
520     WORD wNumberingStart;
521     WORD wNumberingStyle;
522     WORD wNumberingTab;
523     WORD wBorderSpace;
524     WORD wBorderWidth;
525     WORD wBorders;
526 }
527 
528 struct SELCHANGE {
529     NMHDR nmhdr;
530     CHARRANGE chrg;
531     WORD seltyp;
532 }
533 
534 struct TEXTRANGEA {
535     CHARRANGE chrg;
536     LPSTR lpstrText;
537 }
538 
539 struct TEXTRANGEW {
540     CHARRANGE chrg;
541     LPWSTR lpstrText;
542 }
543 
544 struct REQRESIZE {
545     NMHDR nmhdr;
546     RECT rc;
547 }
548 
549 struct REPASTESPECIAL {
550 align(4):
551     DWORD dwAspect;
552     DWORD_PTR dwParam;
553 }
554 
555 struct PUNCTUATION {
556 align(4):
557     UINT iSize;
558     LPSTR szPunctuation;
559 }
560 
561 struct GETTEXTEX {
562 align(4):
563     DWORD cb;
564     DWORD flags;
565     UINT codepage;
566     LPCSTR lpDefaultChar;
567     LPBOOL lpUsedDefChar;
568 }
569 
570 extern (Windows) {
571 alias LONG function(char*,LONG,BYTE,INT) EDITWORDBREAKPROCEX;
572 }
573 
574 /* Defines for EM_SETTYPOGRAPHYOPTIONS */
575 enum TO_ADVANCEDTYPOGRAPHY = 1;
576 enum TO_SIMPLELINEBREAK    = 2;
577 
578 /* Defines for GETTEXTLENGTHEX */
579 enum GTL_DEFAULT  = 0;
580 enum GTL_USECRLF  = 1;
581 enum GTL_PRECISE  = 2;
582 enum GTL_CLOSE    = 4;
583 enum GTL_NUMCHARS = 8;
584 enum GTL_NUMBYTES = 16;
585 
586 struct GETTEXTLENGTHEX {
587 align(4):
588     DWORD flags;
589     UINT codepage;
590 }
591 
592 version (Unicode) {
593     alias CHARFORMATW CHARFORMAT;
594     alias CHARFORMAT2W CHARFORMAT2;
595     alias FINDTEXTW FINDTEXT;
596     alias FINDTEXTEXW FINDTEXTEX;
597     alias TEXTRANGEW TEXTRANGE;
598 } else {
599     alias CHARFORMATA CHARFORMAT;
600     alias CHARFORMAT2A CHARFORMAT2;
601     alias FINDTEXTA FINDTEXT;
602     alias FINDTEXTEXA FINDTEXTEX;
603     alias TEXTRANGEA TEXTRANGE;
604 }