1 <!-- $XConsortium: DtEditor.sgm /main/8 1996/09/08 19:59:04 rws $ -->
2 <!-- (c) Copyright 1995 Digital Equipment Corporation. -->
3 <!-- (c) Copyright 1995 Hewlett-Packard Company. -->
4 <!-- (c) Copyright 1995 International Business Machines Corp. -->
5 <!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
6 <!-- (c) Copyright 1995 Novell, Inc. -->
7 <!-- (c) Copyright 1995 FUJITSU LIMITED. -->
8 <!-- (c) Copyright 1995 Hitachi. -->
10 <![ %CDE.C.CDE; [<RefEntry Id="CDEMX.XCSA.MAN73.rsml.1">]]>
11 <![ %CDE.C.XO; [<RefEntry Id="XCSA.MAN73.rsml.1">]]>
13 <RefEntryTitle>Dt/Editor.h</RefEntryTitle>
14 <ManVolNum>file formats</ManVolNum>
17 <RefName><Filename>Dt/Editor.h</Filename></RefName>
18 <RefPurpose>editor widget definitions
21 <!-- CDE Common Source Format, Version 1.0.0-->
22 <!-- *************************************************************************-->
23 <!-- ** (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company-->
24 <!-- ** (c) Copyright 1993, 1994, 1995 International Business Machines Corp.-->
25 <!-- ** (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.-->
26 <!-- ** (c) Copyright 1993, 1994, 1995 Novell, Inc.-->
27 <!-- *************************************************************************-->
29 <Synopsis>#include <Dt/Editor.h>
33 <Title>DESCRIPTION</Title>
35 <Filename Role="Header">Dt/Editor.h</Filename> header defines structures, enumerations and function prototypes for
36 the Editor widget class.
38 <Para>The header defines the
39 <StructName Role="typedef">DtEditorDataFormat</StructName> enumeration data type,
40 with at least the following members:
44 <Term>DtEDITOR_TEXT</Term>
46 <Para>The data being transferred is a pointer
48 <SystemItem Class="Constant">NULL</SystemItem>−terminated string of characters (a <StructName Role="typedef">char *</StructName>).
53 <Term>DtEDITOR_WCHAR</Term>
55 <Para>The data being transferred is a
56 wide character string (a <StructName Role="typedef">wchar_t *</StructName>).
61 <Term>DtEDITOR_DATA</Term>
63 <Para>The data being transferred is a
65 <StructName Role="typedef">DtEditor_DataObj</StructName>).</Para>
69 <Para>The header defines the following structure:
71 <InformalExample Remap="indent">
72 <ProgramListing>typedef struct {
73 unsigned int <Symbol Role="Variable">length</Symbol>;
74 void *<Emphasis>buf</Emphasis>;
79 <Symbol Role="Variable">length</Symbol> argument is the
80 size in bytes of the data buffer.
82 <Emphasis>buf</Emphasis> argument is a
83 pointer to the data buffer.
86 <StructName Role="typedef">DtEditorContentRec</StructName> structure is used to transfer data between
87 an application and Editor widget.
88 It indicates the type of data being
89 transferred along with the actual data.
91 <InformalExample Remap="indent">
92 <ProgramListing>typedef struct {
93 DtEditorDataFormat <Symbol Role="Variable">type</Symbol>;
95 char <Emphasis>*string</Emphasis>;
96 wchar_t <Emphasis>*wchar</Emphasis>;
97 DtEditor_DataObj <Symbol Role="Variable">data</Symbol>;
98 } <Symbol Role="Variable">value</Symbol>;
103 <Symbol Role="Variable">type</Symbol> argument
104 indicates the type of data contained in the structure.
106 <Symbol Role="Variable">string</Symbol> argument
108 <SystemItem Class="Constant">NULL</SystemItem>−terminated string of characters.
110 <Symbol Role="Variable">type</Symbol> is
111 <SystemItem Class="Constant">DtEDITOR_TEXT</SystemItem>. The
112 <Emphasis>wchar</Emphasis> argument
113 points to a wide character string.
115 <Symbol Role="Variable">type</Symbol> is
116 <SystemItem Class="Constant">DtEDITOR_WCHAR</SystemItem>. The
117 <Symbol Role="Variable">data</Symbol> argument
119 <StructName Role="typedef">DtEditor_DataObj</StructName> that contains the size of the
120 data and a pointer to it.
122 <Symbol Role="Variable">type</Symbol> is
123 <SystemItem Class="Constant">DtEDITOR_DATA</SystemItem>.</Para>
125 <StructName Role="typedef">DtEditorChangeValues</StructName> structure is used optionally to specify
126 the string to search for and its replacement value for
127 &cdeman.DtEditorChange;.</Para>
128 <InformalExample Remap="indent">
129 <ProgramListing>typedef struct {
130 char *<Emphasis>find</Emphasis>,
131 char *<Emphasis>changeTo</Emphasis>,
132 } DtEditorChangeValues;
136 <Emphasis>find</Emphasis> argument
137 is a text string to locate in an DtEditor widget.
139 <Emphasis>changeTo</Emphasis> argument
140 is the replacement string for the one or more occurrences of the string
142 <Emphasis>find</Emphasis>. It can be
143 <SystemItem Class="Constant">NULL</SystemItem>.</Para>
145 <StructName Role="typedef">DtEditorFormatSettings</StructName> structure is used to optionally specify
146 the left margin setting, right margin setting, and alignment style for
147 &cdeman.DtEditorFormat;.</Para>
148 <InformalExample Remap="indent">
149 <ProgramListing>typedef struct {
150 int <Emphasis>leftMargin</Emphasis>,
151 int <Emphasis>rightMargin</Emphasis>,
152 unsigned int <Symbol Role="Variable">alignment</Symbol>,
153 } DtEditorFormatSettings;
157 <Emphasis>leftMargin</Emphasis> argument
158 is the column number of the left boundary when formatting text.
159 Text is not extended to the left of this column.
160 It must be non-negative.
162 <Emphasis>rightMargin</Emphasis> argument
163 is the column number of the right boundary when formatting text.
164 Text is not extended to the right of this column.
165 It must be larger than
166 <Emphasis>leftMargin</Emphasis>. The
167 <Symbol Role="Variable">alignment</Symbol> argument
168 specifies the style of alignment when formatting text (see the
169 constants listed in this header).
172 header declares the following variable:
174 <InformalExample Remap="indent">
175 <ProgramListing>WidgetClass dtEditorWidgetClass;
179 header defines the following constants for use with the
180 &cdeman.DtEditorChange; function:
184 <Term>DtEDITOR_ALL_OCCURRENCES</Term>
186 <Para>Change all instances of the find string.
191 <Term>DtEDITOR_CURRENT_SELECTION</Term>
193 <Para>Replace the currently selected text with the replacement string.
198 <Term>DtEDITOR_NEXT_OCCURRENCE</Term>
200 <Para>Change the next occurrence of the find string after the insertion
207 header defines the following constants for use with the
208 &cdeman.DtEditorFormat; function:
212 <Term>DtEDITOR_FORMAT_ALL</Term>
214 <Para>Reformats all the text in a DtEditor.
219 <Term>DtEDITOR_FORMAT_PARAGRAPH</Term>
221 <Para>Reformats only the paragraph containing the insertion cursor.
226 <Term>DtEDITOR_ALIGN_CENTER</Term>
228 <Para>Centers each line of text between the left and right margins.
233 <Term>DtEDITOR_ALIGN_JUSTIFY</Term>
235 <Para>Aligns the text flush with both the left and right margins.
240 <Term>DtEDITOR_ALIGN_LEFT</Term>
242 <Para>Aligns the text flush with the left margin.
247 <Term>DtEDITOR_ALIGN_RIGHT</Term>
249 <Para>Aligns the text flush with the right margin.
255 header defines the following constant for use with the
256 &cdeman.DtEditorGoToLine; function:
260 <Term>DtEDITOR_LAST_LINE</Term>
262 <Para>Moves the cursor to the beginning of the last line in the widget.
268 header defines the following
269 <StructName Role="typedef">DtEditorErrorCode</StructName> constants:
273 <Term>DtEDITOR_NO_ERRORS</Term>
275 <Para>The function completed its task without errors.
276 <![ %CDE.C.CDE; [</Para>
280 <Term>DtEDITOR_INSUFFICIENT_MEMORY</Term>
282 <Para>Not enough system memory is available to complete the task.
287 <Term>DtEDITOR_INVALID_TYPE</Term>
289 <Para>The specified type is not a recognized
290 <StructName Role="typedef">DtEditorDataFormat</StructName> when setting or retrieving contents or the specified
291 Alignment type is not recognized when formatting text.
296 <Term>DtEDITOR_INVALID_RANGE</Term>
298 <Para>The starting character position in a text replacement is greater than
299 the ending character position or the specified Amount To Format
300 when formatting text is not recognized.
305 <Term>DtEDITOR_NULL_ITEM</Term>
307 <Para>The data buffer is
308 <SystemItem Class="Constant">NULL</SystemItem> when passing data in a buffer.
313 <Term>DtEDITOR_ILLEGAL_SIZE</Term>
315 <Para>The specified size of a data buffer is negative when passing data in a
316 buffer, or the left and right margin values are illegal when formatting text.
317 <![ %CDE.C.CDE; [</Para>
321 <Term>DtEDITOR_SPELL_FILTER_FAILED</Term>
324 <Function>DtEditor</Function> function cannot successfully execute the filter specified by the
325 <SystemItem Class="Resource">DtNspellFilter</SystemItem> resource.
330 <Term>DtEDITOR_NO_TMP_FILE</Term>
333 <Function>DtEditor</Function> function cannot create a temporary file in the directory returned by
334 <Function>tmpnam</Function>3S. ]]></Para>
338 <Term>DtEDITOR_INVALID_FILENAME</Term>
340 <Para>No file was specified.
345 <Term>DtEDITOR_NONEXISTENT_FILE</Term>
347 <Para>The file specified for reading does not exist.
352 <Term>DtEDITOR_UNREADABLE_FILE</Term>
354 <Para>The file specified is unreadable for an unspecified reason.
359 <Term>DtEDITOR_READ_ONLY_FILE</Term>
361 <Para>The file is read only.
362 <![ %CDE.C.CDE; [</Para>
366 <Term>DtEDITOR_NULLS_REMOVED</Term>
368 <Para>The file contained embedded
369 <SystemItem Class="Constant">NULL</SystemItem> characters, which were removed.
374 <Term>DtEDITOR_NO_FILE_ACCESS</Term>
376 <Para>The file cannot be accessed.
381 <Term>DtEDITOR_DIRECTORY</Term>
383 <Para>The file specified is a directory.
388 <Term>DtEDITOR_CHAR_SPECIAL_FILE</Term>
390 <Para>The file specified is a character-special device.
395 <Term>DtEDITOR_BLOCK_MODE_FILE</Term>
397 <Para>The file specified is a block-mode device.
402 <Term>DtEDITOR_UNWRITABLE_FILE</Term>
404 <Para>The application does not have write permission for the file or directory.
409 <Term>DtEDITOR_WRITABLE_FILE</Term>
411 <Para>The specified file exists and the
412 <Emphasis>overwriteIfExists</Emphasis> flag is set to
418 <Term>DtEDITOR_SAVE_FAILED</Term>
420 <Para>The contents of the widget could not be saved for an unspecified reason.
426 header defines the following
427 enumeration values as reasons for the
428 <SystemItem Class="Resource">DtNtextSelectCallback</SystemItem>:</Para>
431 <Term>DtEDITOR_TEXT_SELECT</Term>
433 <Para>Some text has been selected within the edit window (that is, the selection
435 <SystemItem Class="Constant">NULL</SystemItem>).</Para>
439 <Term>DtEDITOR_TEXT_DESELECT</Term>
441 <Para>No text is selected within the edit window (that is, the selection
443 <SystemItem Class="Constant">NULL</SystemItem>).</Para>
448 header defines the following constants as reasons for the
449 <SystemItem Class="Resource">XmNhelpCallback</SystemItem>:</Para>
452 <Term>DtEDITOR_HELP_EDIT_WINDOW</Term>
454 <Para>The help request originated in the edit window.
455 <![ %CDE.C.CDE; [</Para>
459 <Term>DtEDITOR_HELP_STATUS_LINE</Term>
461 <Para>The help request originated in the status line.
466 <Term>DtEDITOR_HELP_STATUS_CURRENT_LINE</Term>
468 <Para>The help request originated from the Current Line Number
469 display in the status line.
474 <Term>DtEDITOR_HELP_STATUS_TOTAL_LINES</Term>
476 <Para>The help request originated from the Total Lines display in
482 <Term>DtEDITOR_HELP_STATUS_MESSAGE</Term>
484 <Para>The help request originated from the Message field in the
490 <Term>DtEDITOR_HELP_STATUS_OVERSTRIKE</Term>
492 <Para>The help request originated from the Overstrike indicator
498 <Term>DtEDITOR_HELP_FORMAT_DIALOG</Term>
500 <Para>The help request originated from the Help button in the
501 Format Settings dialog.
506 <Term>DtEDITOR_HELP_FORMAT_LEFT_MARGIN</Term>
508 <Para>The help request originated from the Left Margin field in
509 the Format Settings dialog.
514 <Term>DtEDITOR_HELP_FORMAT_RIGHT_MARGIN</Term>
516 <Para>The help request originated from the Right Margin Field in
517 the Format Settings dialog.
522 <Term>DtEDITOR_HELP_FORMAT_ALIGNMENT</Term>
524 <Para>The help request originated from the Alignment buttons in the Format Settings
530 <Term>DtEDITOR_HELP_CHANGE_DIALOG</Term>
532 <Para>The help request originated from the Help button in the Find/Change dialog.
537 <Term>DtEDITOR_HELP_CHANGE_FIND</Term>
539 <Para>The help request originated from the Find field in the Find/Change dialog.
544 <Term>DtEDITOR_HELP_CHANGE_CHANGE</Term>
546 <Para>The help request originated from the Change To field in the Find/Change dialog.
547 <![ %CDE.C.CDE; [</Para>
551 <Term>DtEDITOR_HELP_SPELL_DIALOG</Term>
553 <Para>The help request originated from the Help button in the Spell dialog.
558 <Term>DtEDITOR_HELP_SPELL_MISSPELLED_WORDS</Term>
560 <Para>The help request originated from the list of misspelled words in the Spell dialog.
565 <Term>DtEDITOR_HELP_SPELL_CHANGE</Term>
567 <Para>The help request originated from the Change To field in the Spell dialog.
573 header defines the following as functions:
575 <Synopsis>Widget DtCreateEditor(Widget <Symbol Role="Variable">parent</Symbol>,
576 char *<Symbol Role="Variable">name</Symbol>,
577 ArgList <Symbol Role="Variable">arglist</Symbol>,
578 Cardinal <Symbol Role="Variable">argcount</Symbol>);
580 <Synopsis>DtEditorErrorCode DtEditorAppend(Widget <Symbol Role="Variable">widget</Symbol>,
581 DtEditorContentRec *<Symbol Role="Variable">data</Symbol>);
583 <Synopsis>DtEditorErrorCode DtEditorAppendFromFile(Widget <Symbol Role="Variable">widget</Symbol>,
584 char *<Emphasis>fileName</Emphasis>);
586 <Synopsis>Boolean DtEditorChange(Widget <Symbol Role="Variable">widget</Symbol>,
587 DtEditorChangeValues *<Emphasis>findChangeStrings</Emphasis>,
588 unsigned int <Emphasis>instanceToChange</Emphasis>);
590 <Synopsis>Boolean DtEditorCheckForUnsavedChanges(Widget <Symbol Role="Variable">widget</Symbol>);
592 <Synopsis>Boolean DtEditorClearSelection(Widget <Symbol Role="Variable">widget</Symbol>);
594 <Synopsis>Boolean DtEditorCopyToClipboard(Widget <Symbol Role="Variable">widget</Symbol>);
596 <Synopsis>Boolean DtEditorCutToClipboard(Widget <Symbol Role="Variable">widget</Symbol>);
598 <Synopsis>Boolean DtEditorDeleteSelection(Widget <Symbol Role="Variable">widget</Symbol>);
600 <Synopsis>Boolean DtEditorDeselect(Widget <Symbol Role="Variable">widget</Symbol>);
603 <Synopsis>void DtEditorDisableRedisplay(Widget <Symbol Role="Variable">widget</Symbol>);
605 <Synopsis>void DtEditorEnableRedisplay(Widget <Symbol Role="Variable">widget</Symbol>);
608 <Synopsis>Boolean DtEditorFind(Widget <Symbol Role="Variable">widget</Symbol>,
609 char * <Emphasis>find</Emphasis>);
611 <Synopsis>DtEditorErrorCode DtEditorFormat(Widget <Symbol Role="Variable">widget</Symbol>,
612 DtEditorFormatSettings *<Emphasis>formatSettings</Emphasis>,
613 unsigned int <Emphasis>amountToFormat</Emphasis>);
615 <Synopsis>DtEditorErrorCode DtEditorGetContents(Widget <Symbol Role="Variable">widget</Symbol>,
616 DtEditorContentRec *<Symbol Role="Variable">data</Symbol>,
617 Boolean <Emphasis>hardCarriageReturns</Emphasis>,
618 Boolean <Emphasis>markContentsAsSaved</Emphasis>);
620 <Synopsis>XmTextPosition DtEditorGetInsertionPosition(Widget <Symbol Role="Variable">widget</Symbol>);
622 <Synopsis>XmTextPosition DtEditorGetLastPosition(Widget <Symbol Role="Variable">widget</Symbol>);
624 <Para><![ %CDE.C.CDE; [</Para>
625 <Synopsis>Widget DtEditorGetMessageTextFieldID(Widget <Symbol Role="Variable">widget</Symbol>);
628 <Synopsis>void DtEditorGetSizeHints(Widget <Symbol Role="Variable">widget</Symbol>,
629 XSizeHints *<Emphasis>pHints</Emphasis>);
631 <Synopsis>void DtEditorGoToLine(Widget <Symbol Role="Variable">widget</Symbol>,
632 int <Emphasis>lineNumber</Emphasis>);
634 <Synopsis>DtEditorErrorCode DtEditorInsert(Widget <Symbol Role="Variable">widget</Symbol>,
635 DtEditorContentRec *<Symbol Role="Variable">data</Symbol>);
637 <Synopsis>DtEditorErrorCode DtEditorInsertFromFile(Widget <Symbol Role="Variable">widget</Symbol>,
638 char *<Emphasis>fileName</Emphasis>);
640 <Synopsis>void DtEditorInvokeFindChangeDialog(Widget <Symbol Role="Variable">widget</Symbol>);
642 <Synopsis>void DtEditorInvokeFormatDialog(Widget <Symbol Role="Variable">widget</Symbol>);
644 <Para><![ %CDE.C.CDE; [</Para>
645 <Synopsis>DtEditorErrorCode DtEditorInvokeSpellDialog(Widget <Symbol Role="Variable">widget</Symbol>);
648 <Synopsis>Boolean DtEditorPasteFromClipboard(Widget <Symbol Role="Variable">widget</Symbol>);
650 <Synopsis>DtEditorErrorCode DtEditorReplace(Widget <Symbol Role="Variable">widget</Symbol>,
651 XmTextPosition <Symbol Role="Variable">startPos</Symbol>,
652 XmTextPosition <Symbol Role="Variable">endPos</Symbol>,
653 DtEditorContentRec *<Symbol Role="Variable">data</Symbol>);
655 <Synopsis>DtEditorErrorCode DtEditorReplaceFromFile(Widget <Symbol Role="Variable">widget</Symbol>,
656 XmTextPosition <Symbol Role="Variable">startPos</Symbol>,
657 XmTextPosition <Symbol Role="Variable">endPos</Symbol>,
658 char *<Emphasis>fileName</Emphasis>);
660 <Para><![ %CDE.C.CDE; [</Para>
661 <Synopsis>void DtEditorReset(Widget <Symbol Role="Variable">widget</Symbol>);
664 <Synopsis>DtEditorErrorCode DtEditorSaveContentsToFile(Widget <Symbol Role="Variable">widget</Symbol>,
665 char *<Emphasis>fileName</Emphasis>,
666 Boolean <Emphasis>overwriteIfExists</Emphasis>,
667 Boolean <Emphasis>hardCarriageReturns</Emphasis>,
668 Boolean <Emphasis>markContentsAsSaved</Emphasis>);
670 <Synopsis>Boolean DtEditorSelectAll(Widget <Symbol Role="Variable">widget</Symbol>);
672 <Synopsis>DtEditorErrorCode DtEditorSetContents(Widget <Symbol Role="Variable">widget</Symbol>,
673 DtEditorContentRec *<Symbol Role="Variable">data</Symbol>);
675 <Synopsis>DtEditorErrorCode DtEditorSetContentsFromFile(Widget <Symbol Role="Variable">widget</Symbol>,
676 char *<Emphasis>fileName</Emphasis>);
678 <Synopsis>void DtEditorSetInsertionPosition(Widget <Symbol Role="Variable">widget</Symbol>,
679 XmTextPosition <Symbol Role="Variable">position</Symbol>);
681 <Synopsis>void DtEditorTraverseToEditor(Widget <Symbol Role="Variable">widget</Symbol>);
683 <Synopsis>Boolean DtEditorUndoEdit(Widget <Symbol Role="Variable">widget</Symbol>);
688 <Title>SEE ALSO</Title>
689 <Para>&cdeman.DtCreateEditor;, &cdeman.DtEditor;,
690 &cdeman.DtEditorAppend;,
691 &cdeman.DtEditorAppendFromFile;,
692 &cdeman.DtEditorChange;,
693 &cdeman.DtEditorCheckForUnsavedChanges;,
694 &cdeman.DtEditorClearSelection;,
695 &cdeman.DtEditorCopyToClipboard;,
696 &cdeman.DtEditorCutToClipboard;,
697 &cdeman.DtEditorDeleteSelection;,
698 &cdeman.DtEditorDeselect;, &cdeman.DtEditorFind;,
699 &cdeman.DtEditorFormat;,
700 &cdeman.DtEditorGetContents;,
701 &cdeman.DtEditorGetInsertionPosition;,
702 &cdeman.DtEditorGetLastPosition;,
703 &cdeman.DtEditorGetMessageTextFieldID;,
704 &cdeman.DtEditorGetSizeHints;,
705 &cdeman.DtEditorGoToLine;, &cdeman.DtEditorInsert;,
706 &cdeman.DtEditorInsertFromFile;,
707 &cdeman.DtEditorInvokeFindChangeDialog;,
708 &cdeman.DtEditorInvokeFormatDialog;,
709 &cdeman.DtEditorInvokeSpellDialog;,
710 &cdeman.DtEditorPasteFromClipboard;,
711 &cdeman.DtEditorReplace;,
712 &cdeman.DtEditorReplaceFromFile;,
713 &cdeman.DtEditorReset;,
714 &cdeman.DtEditorSaveContentsToFile;,
715 &cdeman.DtEditorSelectAll;,
716 &cdeman.DtEditorSetContents;,
717 &cdeman.DtEditorSetContentsFromFile;,
718 &cdeman.DtEditorSetInsertionPosition;,
719 &cdeman.DtEditorTraverseToEditor;,
720 &cdeman.DtEditorUndoEdit;.</Para>
724 <!--fickle 1.12 mancsf-to-docbook 1.2 08/07/95 23:40:24-->