1 |
|
---|
2 | /*
|
---|
3 | *@@sourcefile textview.h:
|
---|
4 | * header file for textview.c. See remarks there.
|
---|
5 | *
|
---|
6 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
7 | * numbering.
|
---|
8 | */
|
---|
9 |
|
---|
10 | /* Copyright (C) 2000-2008 Ulrich Mller.
|
---|
11 | * This file is part of the "XWorkplace helpers" source package.
|
---|
12 | * This is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published
|
---|
14 | * by the Free Software Foundation, in version 2 as it comes in the
|
---|
15 | * "COPYING" file of the XWorkplace main distribution.
|
---|
16 | * This program is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | * GNU General Public License for more details.
|
---|
20 | *
|
---|
21 | *@@include #define INCL_SPL // for printing functions
|
---|
22 | *@@include #include <os2.h>
|
---|
23 | *@@include #include "helpers\linklist.h" // for device-independent functions
|
---|
24 | *@@include #include "helpers\xstring.h" // for device-independent functions
|
---|
25 | *@@include #include "helpers\textview.h"
|
---|
26 | */
|
---|
27 |
|
---|
28 | #if __cplusplus
|
---|
29 | extern "C" {
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #ifndef TEXTVIEW_HEADER_INCLUDED
|
---|
33 | #define TEXTVIEW_HEADER_INCLUDED
|
---|
34 |
|
---|
35 | /* ******************************************************************
|
---|
36 | *
|
---|
37 | * Escape sequences
|
---|
38 | *
|
---|
39 | ********************************************************************/
|
---|
40 |
|
---|
41 | /*
|
---|
42 | *@@ TXVESC_CHAR:
|
---|
43 | * general escape character which introduces
|
---|
44 | * all escape sequences.
|
---|
45 | */
|
---|
46 |
|
---|
47 | #define TXVESC_CHAR '\xFF'
|
---|
48 | #define TXVESC_STRING "\xFF"
|
---|
49 |
|
---|
50 | // fixed formatting tags: PRE, B, I U, STRIKE
|
---|
51 | // (no parameters)
|
---|
52 | /* #define TXVESC_PRE_BEGIN TXVESC_STRING "\x01\x01"
|
---|
53 | #define TXVESC_PRE_END TXVESC_STRING "\x01\x02" */
|
---|
54 |
|
---|
55 | #define TXVESC_SET_FONT TXVESC_STRING "\x01"
|
---|
56 | // here follow three characters with the
|
---|
57 | // font index:
|
---|
58 | // e.g. "000" == default font
|
---|
59 | // "001" == monospaced font
|
---|
60 | // Fonts 0 and 1 always exist in the XTextView control.
|
---|
61 | // Other fonts are presently not supported.
|
---|
62 | // --> total size: 5
|
---|
63 |
|
---|
64 | #define TXVESC_BOLD_BEGIN TXVESC_STRING "\x02\x01"
|
---|
65 | #define TXVESC_BOLD_END TXVESC_STRING "\x02\x02"
|
---|
66 |
|
---|
67 | #define TXVESC_ITALICS_BEGIN TXVESC_STRING "\x03\x01"
|
---|
68 | #define TXVESC_ITALICS_END TXVESC_STRING "\x03\x02"
|
---|
69 |
|
---|
70 | #define TXVESC_UNDERLINE_BEGIN TXVESC_STRING "\x04\x01"
|
---|
71 | #define TXVESC_UNDERLINE_END TXVESC_STRING "\x04\x02"
|
---|
72 |
|
---|
73 | #define TXVESC_STRIKE_BEGIN TXVESC_STRING "\x05\x01"
|
---|
74 | #define TXVESC_STRIKE_END TXVESC_STRING "\x05\x02"
|
---|
75 |
|
---|
76 | // links
|
---|
77 | #define TXVESC_LINK_BEGIN TXVESC_STRING "\x06"
|
---|
78 | // here follows the link reference, which
|
---|
79 | // is variable in length and must be terminated
|
---|
80 | // with another 0xFF escape code (NOT null byte);
|
---|
81 | // --> total size: 2 plus link name length
|
---|
82 | // plus 1 for 0xFF terminator
|
---|
83 |
|
---|
84 | #define TXVESC_LINK_END TXVESC_STRING "\x07"
|
---|
85 | // end of the link
|
---|
86 | // --> total size: 2
|
---|
87 |
|
---|
88 | #define TXVESC_ANCHORNAME TXVESC_STRING "\x08"
|
---|
89 | // here follows the anchor name, which is
|
---|
90 | // variable in length and must be terminated
|
---|
91 | // with another 0xFF escape code (NOT null byte);
|
---|
92 | // --> total size: 2 plus anchor name length
|
---|
93 | // plus 1 for 0xFF terminator
|
---|
94 |
|
---|
95 | // character formatting with parameters:
|
---|
96 | #define TXVESC_POINTSIZE_REL TXVESC_STRING "\x10"
|
---|
97 | // here follow three characters with a percentage
|
---|
98 | // of the default point size
|
---|
99 | // e.g. "050" == half the size
|
---|
100 | // "200" == double the size
|
---|
101 | // --> total size: 5
|
---|
102 |
|
---|
103 | /*
|
---|
104 | * paragraph formatting
|
---|
105 | * -- left and right margins:
|
---|
106 | */
|
---|
107 |
|
---|
108 | #define TXVESC_LEFTMARGIN TXVESC_STRING "\x20"
|
---|
109 | // here follow four characters to specify the
|
---|
110 | // new first line left margin (XFMTPARAGRAPH.lLeftMargin),
|
---|
111 | // which is based on the average char width of
|
---|
112 | // the current font:
|
---|
113 | // e.g. "0020" == set margin to 20 average char widths
|
---|
114 | // --> total size: 6
|
---|
115 |
|
---|
116 | #define TXVESC_FIRSTLINEMARGIN_LEFT TXVESC_STRING "\x21-"
|
---|
117 | #define TXVESC_FIRSTLINEMARGIN_RIGHT TXVESC_STRING "\x21+"
|
---|
118 | // here follow three characters to specify the
|
---|
119 | // new absolute left margin (XFMTPARAGRAPH.lFirstLineMargin)
|
---|
120 | // which is based on the average char width of
|
---|
121 | // the current font:
|
---|
122 | // e.g. "+020" == set first line margin to 20 average char widths
|
---|
123 | // e.g. "-020" == set first line margin to 20 average char widths
|
---|
124 | // --> total size: 6
|
---|
125 |
|
---|
126 | #define TXVESC_TAB TXVESC_STRING "\x22"
|
---|
127 | // the tab can be used to move from the first line margin
|
---|
128 | // to the left margin, if the first line margin is negative;
|
---|
129 | // used with list items (UL LI and such)
|
---|
130 | // --> total size: 2
|
---|
131 |
|
---|
132 | #define TXVESC_MARKER TXVESC_STRING "\x23"
|
---|
133 | // draw marker at the current position: the next byte
|
---|
134 | // determines the type of marker:
|
---|
135 | // -- 1: disc (filled circle)
|
---|
136 | // -- 2: square (filled box)
|
---|
137 | // -- 3: circle (hollow circle)
|
---|
138 | // --> total size: 3
|
---|
139 |
|
---|
140 | /*
|
---|
141 | * paragraph formatting
|
---|
142 | * -- paragraph spacing:
|
---|
143 | */
|
---|
144 |
|
---|
145 | #define TXVESC_SPACEBEFORE TXVESC_STRING "\x30"
|
---|
146 | #define TXVESC_SPACEAFTER TXVESC_STRING "\x31"
|
---|
147 | // here follow four characters to specify the
|
---|
148 | // new spacing before or after a paragraph:
|
---|
149 | // e.g. "0020" == twenty
|
---|
150 | // !! special case: "####" means reset to default
|
---|
151 | // --> total size: 6
|
---|
152 |
|
---|
153 | #define TXVESC_WORDWRAP TXVESC_STRING "\x32"
|
---|
154 | // here follows a single character being "0" or "1"
|
---|
155 | // --> total size: 3
|
---|
156 |
|
---|
157 | /* ******************************************************************
|
---|
158 | *
|
---|
159 | * Device-independent functions
|
---|
160 | *
|
---|
161 | ********************************************************************/
|
---|
162 |
|
---|
163 | #define TXVWORDF_GLUEWITHNEXT 1 // escape
|
---|
164 | #define TXVWORDF_LINEBREAK 2 // \n
|
---|
165 | #define TXVWORDF_LINEFEED 4 // \r
|
---|
166 |
|
---|
167 | typedef struct _TXVRECTANGLE *PTXVRECTANGLE;
|
---|
168 |
|
---|
169 | /*
|
---|
170 | *@@ TXVWORD:
|
---|
171 | * this defines a "word" to be drawn. A word is
|
---|
172 | * normally a sequence of characters between
|
---|
173 | * space, \n, or \r characters, unless escape
|
---|
174 | * sequences come up. See txvFormatText.
|
---|
175 | *
|
---|
176 | *@@added V0.9.3 (2000-05-14) [umoeller]
|
---|
177 | */
|
---|
178 |
|
---|
179 | typedef struct _TXVWORD
|
---|
180 | {
|
---|
181 | const char *pStart; // ptr into TEXTVIEWWINDATA.pszViewText
|
---|
182 | ULONG cChars; // characters in line to draw, starting
|
---|
183 | // at pStartOfLine;
|
---|
184 | // this might be less than the next \n
|
---|
185 | // char if word-wrapping has been enabled
|
---|
186 | // or an escape character was found
|
---|
187 |
|
---|
188 | CHAR cEscapeCode;
|
---|
189 | // if 0, this word represents a substring to be painted
|
---|
190 | // ("normal word").
|
---|
191 | // If != 0; this "word" holds an escape sequence in *pStart
|
---|
192 | // which must be considered for paragraph formatting, but
|
---|
193 | // NOT be painted, except if fPaintEscapeWord is TRUE also.
|
---|
194 | // cEscapeCode then holds a copy of the escape character
|
---|
195 | // (which is pStart + 1).
|
---|
196 | BOOL fPaintEscapeWord;
|
---|
197 | // if this is TRUE, this escape is some special graphics
|
---|
198 | // to be painted also (e.g. list markers). txvPaint then
|
---|
199 | // evaluates the escape code (in pStart) to see what needs
|
---|
200 | // to be done.
|
---|
201 |
|
---|
202 | // all the following are only set if (fIsEscapeSequence == FALSE):
|
---|
203 |
|
---|
204 | ULONG ulFlags;
|
---|
205 | // one of the following:
|
---|
206 | // -- TXVWORDF_GLUEWITHNEXT: this "word" was cut because
|
---|
207 | // an escape sequence was found; this word must
|
---|
208 | // therefore be in the same line with the next word
|
---|
209 | // -- TXVWORDF_LINEBREAK: this word ends with a \n char;
|
---|
210 | // start new paragraph after this
|
---|
211 | // -- TXVWORDF_LINEFEED: this words ends with a \r char;
|
---|
212 | // start new line after this
|
---|
213 |
|
---|
214 | ULONG ulCXWithSpaces, // width of word (in pels), including trailing spaces
|
---|
215 | ulCXWord, // width of word (in pels), without trailing spaces
|
---|
216 | ulCY; // height of word (in pels)
|
---|
217 |
|
---|
218 | LONG lX; // X position to paint this word at;
|
---|
219 | // this is (re)set during word-to-rectangle correlation!
|
---|
220 | PTXVRECTANGLE pRectangle; // reverse pointer to the TXVRECTANGLE structure to
|
---|
221 | // which this word belongs; useful for repainting;
|
---|
222 | // this is (re)set during word-to-rectangle correlation!
|
---|
223 | ULONG ulBaseLineOfs; // base line offset; add this to rcl.yBottom
|
---|
224 | // to get the the start point to be used for
|
---|
225 | // GpiCharStringPosAt
|
---|
226 |
|
---|
227 | LONG lcid; // logical font ID to use for this rectangle
|
---|
228 | LONG lPointSize; // point size to use for this rectangle;
|
---|
229 | // this is set to 0 for bitmap fonts
|
---|
230 | ULONG flChar; // flOptions parameter for GpiCharStringPosAt;
|
---|
231 | // this will only have the CHS_UNDERSCORE or
|
---|
232 | // CHS_STRIKEOUT flags set
|
---|
233 |
|
---|
234 | PCSZ pcszLinkTarget; // if != NULL, pointer to a string in XFORMATDATA.llLinks;
|
---|
235 | // the word is then part of a link
|
---|
236 | // V0.9.20 (2002-08-10) [umoeller]
|
---|
237 |
|
---|
238 | } TXVWORD, *PTXVWORD;
|
---|
239 |
|
---|
240 | #ifdef LINKLIST_HEADER_INCLUDED
|
---|
241 | /*
|
---|
242 | *@@ TXVRECTANGLE:
|
---|
243 | * this defines one line to be drawn.
|
---|
244 | * This is device-independent.
|
---|
245 | * See txvFormatText.
|
---|
246 | */
|
---|
247 |
|
---|
248 | typedef struct _TXVRECTANGLE
|
---|
249 | {
|
---|
250 | RECTL rcl; // rectangle of this line, into which
|
---|
251 | // the words in llWords should be painted;
|
---|
252 | // the bottom of this rectangle specifies the
|
---|
253 | // bottommost point used (neccessary for
|
---|
254 | // characters with underlengths, such as
|
---|
255 | // "g" or "y"); ulMaxBaseLineOfs must be
|
---|
256 | // added to the starting point
|
---|
257 | // when using GpiCharStringPosAt
|
---|
258 | ULONG ulMaxBaseLineOfs; // highest ulBaseLineOfs of all words
|
---|
259 | // belonging to this rectangle.
|
---|
260 | LINKLIST llWords; // list of TXVWORD's which belong to this
|
---|
261 | // rectangle. Note that these are duplicate
|
---|
262 | // pointers to be able to correlate rectangles
|
---|
263 | // to words; there is a second list of TXVWORD's
|
---|
264 | // in XFORMATDATA which holds really all the
|
---|
265 | // words which were created (for cleanup).
|
---|
266 | // So one allocated TXVWORD structure can
|
---|
267 | // have two pointers pointing to it.
|
---|
268 | } TXVRECTANGLE;
|
---|
269 | #endif
|
---|
270 |
|
---|
271 | /*
|
---|
272 | *@@ XFMTFONT:
|
---|
273 | * specifies a font to be used in
|
---|
274 | * XFMTCHARACTER.
|
---|
275 | *
|
---|
276 | *@@added V0.9.3 (2000-05-06) [umoeller]
|
---|
277 | */
|
---|
278 |
|
---|
279 | typedef struct _XFMTFONT
|
---|
280 | {
|
---|
281 | LONG lcid;
|
---|
282 | // default font to use for this paragraph
|
---|
283 | FONTMETRICS FontMetrics;
|
---|
284 | LONG alCX[256]; // width of each ASCII character for this
|
---|
285 | // string; computed by txvSetFormatFont
|
---|
286 | } XFMTFONT, *PXFMTFONT;
|
---|
287 |
|
---|
288 | /*
|
---|
289 | *@@ XFMTCHARACTER:
|
---|
290 | * character formatting parameters.
|
---|
291 | * This is used by the formatting engine
|
---|
292 | * (txvFormat)
|
---|
293 | * to describe character formatting.
|
---|
294 | * Character formatting can only be
|
---|
295 | * changed between words (TXVWORD).
|
---|
296 | *
|
---|
297 | *@@added V0.9.3 (2000-05-06) [umoeller]
|
---|
298 | */
|
---|
299 |
|
---|
300 | typedef struct _XFMTCHARACTER
|
---|
301 | {
|
---|
302 | LONG lPointSize;
|
---|
303 | // default font size to use for this paragraph
|
---|
304 | XFMTFONT fntRegular,
|
---|
305 | fntBold,
|
---|
306 | fntItalics,
|
---|
307 | fntBoldItalics;
|
---|
308 | } XFMTCHARACTER, *PXFMTCHARACTER;
|
---|
309 |
|
---|
310 | /*
|
---|
311 | *@@ XFMTPARAGRAPH:
|
---|
312 | * paragraph formatting parameters.
|
---|
313 | * This is used by the formatting engine
|
---|
314 | * (txvFormat)
|
---|
315 | * for every paragraph which is started.
|
---|
316 | *
|
---|
317 | *@@added V0.9.3 (2000-05-06) [umoeller]
|
---|
318 | */
|
---|
319 |
|
---|
320 | typedef struct _XFMTPARAGRAPH
|
---|
321 | {
|
---|
322 | BOOL fWordWrap;
|
---|
323 | LONG lLeftMargin,
|
---|
324 | // left indentation for all lines
|
---|
325 | // (in pixels)
|
---|
326 | lRightMargin,
|
---|
327 | // right indentation for all lines
|
---|
328 | // (in pixels)
|
---|
329 | lFirstLineMargin;
|
---|
330 | // additional indentation for first line only;
|
---|
331 | // this is added to lLeftMargin (can be negative)
|
---|
332 | // (in pixels)
|
---|
333 | LONG lSpaceBefore,
|
---|
334 | // space before each paragraph
|
---|
335 | // (in pixels)
|
---|
336 | lSpaceAfter;
|
---|
337 | // space after each paragraph
|
---|
338 | // (in pixels)
|
---|
339 | } XFMTPARAGRAPH, *PXFMTPARAGRAPH;
|
---|
340 |
|
---|
341 | #ifdef LINKLIST_HEADER_INCLUDED
|
---|
342 | #ifdef XSTRING_HEADER_INCLUDED
|
---|
343 |
|
---|
344 | /*
|
---|
345 | *@@ XFORMATDATA:
|
---|
346 | * text formatting data. Passed to
|
---|
347 | * txvPaintText, stored in TEXTVIEWWINDATA.
|
---|
348 | * This is device-independent.
|
---|
349 | */
|
---|
350 |
|
---|
351 | typedef struct _XFORMATDATA
|
---|
352 | {
|
---|
353 | XSTRING strOrigText; // original text from WinSetWindowText
|
---|
354 |
|
---|
355 | // input to txvFormatText
|
---|
356 | XSTRING strViewText; // view text after conversion
|
---|
357 |
|
---|
358 | XFMTPARAGRAPH
|
---|
359 | fmtpStandard; // standard paragraph format
|
---|
360 |
|
---|
361 | XFMTCHARACTER
|
---|
362 | fmtcStandard, // format for standard text
|
---|
363 | fmtcCode; // format for code text (monospaced; PRE, CODE etc.)
|
---|
364 |
|
---|
365 | // output from txvFormatText
|
---|
366 | LINKLIST llRectangles;
|
---|
367 | // list of TXVRECTANGLE, from top to bottom;
|
---|
368 | // text pointers point into pszViewText
|
---|
369 | LINKLIST llWords;
|
---|
370 | // list of TXVWORD's, in order of creation;
|
---|
371 | // this is just for proper cleanup. The items
|
---|
372 | // in the TXVRECTANGLE.llWords list also point
|
---|
373 | // to the words stored in this list.
|
---|
374 |
|
---|
375 | SIZEL szlWorkspace; // width and height of viewport (total text space)
|
---|
376 |
|
---|
377 | LINKLIST llLinks;
|
---|
378 | // list of malloc'd PSZ's (auto-free) with all
|
---|
379 | // the links encountered while parsing the text.
|
---|
380 | // These are needed for passing the correct link
|
---|
381 | // target names when the user clicks on one.
|
---|
382 | // V0.9.20 (2002-08-10) [umoeller]
|
---|
383 |
|
---|
384 | } XFORMATDATA, *PXFORMATDATA;
|
---|
385 |
|
---|
386 | VOID txvInitFormat(PXFORMATDATA pxfd);
|
---|
387 |
|
---|
388 | VOID txvFormatText(HPS hps,
|
---|
389 | PXFORMATDATA pxfd,
|
---|
390 | PRECTL prclView,
|
---|
391 | BOOL fFullRecalc);
|
---|
392 | #endif
|
---|
393 | #endif
|
---|
394 |
|
---|
395 | VOID txvStripLinefeeds(char **ppszText,
|
---|
396 | ULONG ulTabSize);
|
---|
397 |
|
---|
398 | /* ******************************************************************
|
---|
399 | *
|
---|
400 | * Window-dependent functions
|
---|
401 | *
|
---|
402 | ********************************************************************/
|
---|
403 |
|
---|
404 | /*
|
---|
405 | * XTextView messages:
|
---|
406 | *
|
---|
407 | */
|
---|
408 |
|
---|
409 | // #define TXM_QUERYCHARFORMAT (WM_USER + 1022)
|
---|
410 | // #define TXM_SETCHARFORMAT (WM_USER + 1023)
|
---|
411 | #define TXM_QUERYPARFORMAT (WM_USER + 1022)
|
---|
412 | #define TXM_SETPARFORMAT (WM_USER + 1023)
|
---|
413 | #define TXM_SETWORDWRAP (WM_USER + 1024)
|
---|
414 | #define TXM_QUERYCDATA (WM_USER + 1025)
|
---|
415 | #define TXM_SETCDATA (WM_USER + 1026)
|
---|
416 | #define TXM_JUMPTOANCHORNAME (WM_USER + 1027)
|
---|
417 | #define TXM_QUERYTEXTEXTENT (WM_USER + 1028)
|
---|
418 | #define TXM_QUERYSTYLE (WM_USER + 1029)
|
---|
419 | #define TXM_SETSTYLE (WM_USER + 1030)
|
---|
420 | #define TXM_COPY (WM_USER + 1031)
|
---|
421 |
|
---|
422 | #define WC_XTEXTVIEW "XTextViewClass"
|
---|
423 |
|
---|
424 | /*
|
---|
425 | * XTextView nofication codes:
|
---|
426 | *
|
---|
427 | */
|
---|
428 |
|
---|
429 | /*
|
---|
430 | *@@ TXVN_LINK:
|
---|
431 | * WM_CONTROL notification code posted (!)
|
---|
432 | * to the XTextView control's owner.
|
---|
433 | *
|
---|
434 | * Parameters:
|
---|
435 | *
|
---|
436 | * -- USHORT SHORT1FROMMP(mp1): id of the control.
|
---|
437 | *
|
---|
438 | * -- USHORT SHORT2FROMMP(mp1): nofify code (TXVN_LINK).
|
---|
439 | *
|
---|
440 | * -- const char *mp2: target of the link that the
|
---|
441 | * user clicked on.
|
---|
442 | *
|
---|
443 | *@@added V0.9.3 (2000-05-18) [umoeller]
|
---|
444 | */
|
---|
445 |
|
---|
446 | #define TXVN_LINK 1
|
---|
447 |
|
---|
448 | /*
|
---|
449 | * XTextView window style flags:
|
---|
450 | * all renamed, all turned into window style flags
|
---|
451 | */
|
---|
452 |
|
---|
453 | #define XS_VSCROLL 0x0001 // show vertical scroll bar
|
---|
454 | #define XS_HSCROLL 0x0002 // show horizontal scroll bar
|
---|
455 | #define XS_AUTOVHIDE 0x0004 // with XTXF_VSCROLL: automatically hide scrollbar
|
---|
456 | #define XS_AUTOHHIDE 0x0008 // with XTXF_HSCROLL: automatically hide scrollbar
|
---|
457 |
|
---|
458 | // handy macro V0.9.20 (2002-08-10) [umoeller]
|
---|
459 | #define XS_FULLSCROLL (XS_VSCROLL | XS_HSCROLL | XS_AUTOVHIDE | XS_AUTOHHIDE)
|
---|
460 |
|
---|
461 | #define XS_WORDWRAP 0x0010
|
---|
462 | // enable word-wrapping in the default paragraph
|
---|
463 | // format from the start
|
---|
464 |
|
---|
465 | #define XS_STATIC 0x0020
|
---|
466 | // behave like static control: no focus, be skipped
|
---|
467 | // over with tabbing in dialogs
|
---|
468 | // V0.9.20 (2002-08-10) [umoeller]
|
---|
469 |
|
---|
470 | #define XS_FORMAT_MASK 0x0700
|
---|
471 | #define XS_PREFORMATTED 0x0000 // plain text with \n only plus \xFF escape codes
|
---|
472 | // (no conversion performed)
|
---|
473 | #define XS_PLAINTEXT 0x0100 // plain text with \r and \xFF chars that need conversion
|
---|
474 | #define XS_HTML 0x0200 // HTML
|
---|
475 |
|
---|
476 | /*
|
---|
477 | *@@ XTEXTVIEWCDATA:
|
---|
478 | * control data structure for text view
|
---|
479 | * control. This can be passed to
|
---|
480 | * WinCreateWindow with the pCtlData
|
---|
481 | * parameter. You then MUST set the
|
---|
482 | * "cbData" field to sizeof(XTEXTVIEWCDATA).
|
---|
483 | */
|
---|
484 |
|
---|
485 | typedef struct _XTEXTVIEWCDATA
|
---|
486 | {
|
---|
487 | USHORT cbData;
|
---|
488 | ULONG ulXBorder,
|
---|
489 | // space to leave on the left and right of text view;
|
---|
490 | // defaults to 0
|
---|
491 | ulYBorder;
|
---|
492 | // space to leave on the top and bottom of text view;
|
---|
493 | // defaults to 0
|
---|
494 | ULONG ulVScrollLineUnit,
|
---|
495 | // pixels to scroll if scroll bar "up" or "down" button
|
---|
496 | // is pressed; defaults to 15
|
---|
497 | ulHScrollLineUnit;
|
---|
498 | // pixels to scroll if scroll bar "left" or "right" button
|
---|
499 | // is pressed; defaults to 15
|
---|
500 | } XTEXTVIEWCDATA, *PXTEXTVIEWCDATA;
|
---|
501 |
|
---|
502 |
|
---|
503 | BOOL txvRegisterTextView(HAB hab);
|
---|
504 |
|
---|
505 | HWND txvReplaceWithTextView(HWND hwndParentAndOwner,
|
---|
506 | USHORT usID,
|
---|
507 | ULONG flWinStyle,
|
---|
508 | USHORT usBorder);
|
---|
509 |
|
---|
510 | /* ******************************************************************
|
---|
511 | *
|
---|
512 | * Printer-dependent functions
|
---|
513 | *
|
---|
514 | ********************************************************************/
|
---|
515 |
|
---|
516 | typedef BOOL APIENTRY FNPRINTCALLBACK(ULONG ulPage,
|
---|
517 | ULONG ulUser);
|
---|
518 |
|
---|
519 | #ifdef INCL_SPL
|
---|
520 | BOOL txvPrint(HAB hab,
|
---|
521 | HDC hdc,
|
---|
522 | HPS hps,
|
---|
523 | PSZ pszViewText,
|
---|
524 | ULONG ulSize,
|
---|
525 | PSZ pszFaceName,
|
---|
526 | HCINFO *phci,
|
---|
527 | PSZ pszDocTitle,
|
---|
528 | FNPRINTCALLBACK *pfnCallback);
|
---|
529 | #endif
|
---|
530 |
|
---|
531 | int txvPrintWindow(HWND hwndTextView,
|
---|
532 | PSZ pszDocTitle,
|
---|
533 | FNPRINTCALLBACK *pfnCallback);
|
---|
534 |
|
---|
535 | #endif
|
---|
536 |
|
---|
537 | #if __cplusplus
|
---|
538 | }
|
---|
539 | #endif
|
---|
540 |
|
---|