Dt/Editor.h(5)

NAME
Dt/Editor.h - editor widget definitions

SYNOPSIS
#include <Dt/Editor.h>

DESCRIPTION
The <Dt/Editor.h> header defines structures, enumerations and function prototypes for the Editor widget class.

The header defines the DtEditorDataFormat enumeration data type, with at least the following members:

    The data being transferred is a pointer to a NULL-terminated string of characters (a char *).
    The data being transferred is a wide character string (a wchar_t *).
    The data being transferred is a sized buffer (a DtEditor_DataObj).

The header defines the following structure:

    typedef struct {
    	unsigned int length;
    	void *buf;
    } DtEditor_DataObj;

The length argument is the size in bytes of the data buffer. The buf argument is a pointer to the data buffer.

The DtEditorContentRec structure is used to transfer data between an application and Editor widget. It indicates the type of data being transferred along with the actual data.

    typedef struct {
    	DtEditorDataFormat type;
    	union {
    		char *string;
    		wchar_t *wchar;
    		DtEditor_DataObj data;
    	} value;
    } DtEditorContentRec;

The type argument indicates the type of data contained in the structure. The string argument points to a NULL-terminated string of characters. It is valid when type is DtEDITOR_TEXT. The wchar argument points to a wide character string. It is valid when type is DtEDITOR_WCHAR. The data argument is a DtEditor_DataObj that contains the size of the data and a pointer to it. It is valid when type is DtEDITOR_DATA.

The DtEditorChangeValues structure is used optionally to specify the string to search for and its replacement value for DtEditorChange(3).

    typedef struct {
    	char *find,
    	char *changeTo,
    } DtEditorChangeValues;

The find argument is a text string to locate in an DtEditor widget. The changeTo argument is the replacement string for the one or more occurrences of the string specified in find. It can be NULL.

The DtEditorFormatSettings structure is used to optionally specify the left margin setting, right margin setting, and alignment style for DtEditorFormat(3).

    typedef struct {
    	int leftMargin,
    	int rightMargin,
    	unsigned int alignment,
    } DtEditorFormatSettings;

The leftMargin argument is the column number of the left boundary when formatting text. Text is not extended to the left of this column. It must be non-negative. The rightMargin argument is the column number of the right boundary when formatting text. Text is not extended to the right of this column. It must be larger than leftMargin. The alignment argument specifies the style of alignment when formatting text (see the constants listed in this header).

The header declares the following variable:

    WidgetClass      dtEditorWidgetClass;

The header defines the following constants for use with the DtEditorChange(3) function:

    Change all instances of the find string.
    Replace the currently selected text with the replacement string.
    Change the next occurrence of the find string after the insertion cursor.

The header defines the following constants for use with the DtEditorFormat(3) function:

    Reformats all the text in a DtEditor.
    Reformats only the paragraph containing the insertion cursor.
    Centers each line of text between the left and right margins.
    Aligns the text flush with both the left and right margins.
    Aligns the text flush with the left margin.
    Aligns the text flush with the right margin.

The header defines the following constant for use with the DtEditorGoToLine(3) function:

    Moves the cursor to the beginning of the last line in the widget.

The header defines the following DtEditorErrorCode constants:

    The function completed its task without errors.
    Not enough system memory is available to complete the task.
    The specified type is not a recognized DtEditorDataFormat when setting or retrieving contents or the specified Alignment type is not recognized when formatting text.
    The starting character position in a text replacement is greater than the ending character position or the specified Amount To Format when formatting text is not recognized.
    The data buffer is NULL when passing data in a buffer.
    The specified size of a data buffer is negative when passing data in a buffer, or the left and right margin values are illegal when formatting text.
    The DtEditor() function cannot successfully execute the filter specified by the DtNspellFilter resource.
    The DtEditor() function cannot create a temporary file in the directory returned by tmpnam(3S).
    No file was specified.
    The file specified for reading does not exist.
    The file specified is unreadable for an unspecified reason.
    The file is read only.
    The file contained embedded NULL characters, which were removed.
    The file cannot be accessed.
    The file specified is a directory.
    The file specified is a character-special device.
    The file specified is a block-mode device.
    The application does not have write permission for the file or directory.
    The specified file exists and the overwriteIfExists flag is set to False.
    The contents of the widget could not be saved for an unspecified reason.

The header defines the following enumeration values as reasons for the DtNtextSelectCallback:

    Some text has been selected within the edit window (that is, the selection has become non-NULL).
    No text is selected within the edit window (that is, the selection has become NULL).

The header defines the following constants as reasons for the XmNhelpCallback:

    The help request originated in the edit window.
    The help request originated in the status line.
    The help request originated from the Current Line Number display in the status line.
    The help request originated from the Total Lines display in the status line.
    The help request originated from the Message field in the status line.
    The help request originated from the Overstrike indicator in the status line.
    The help request originated from the Help button in the Format Settings dialog.
    The help request originated from the Left Margin field in the Format Settings dialog.
    The help request originated from the Right Margin Field in the Format Settings dialog.
    The help request originated from the Alignment buttons in the Format Settings dialog.
    The help request originated from the Help button in the Find/Change dialog.
    The help request originated from the Find field in the Find/Change dialog.
    The help request originated from the Change To field in the Find/Change dialog.
    The help request originated from the Help button in the Spell dialog.
    The help request originated from the list of misspelled words in the Spell dialog.
    The help request originated from the Change To field in the Spell dialog.

The header defines the following as functions:

Widget DtCreateEditor(Widget parent,
	char *name,
	ArgList arglist,
	Cardinal argcount);

DtEditorErrorCode DtEditorAppend(Widget widget,
	DtEditorContentRec *data);

DtEditorErrorCode DtEditorAppendFromFile(Widget widget,
	char *fileName);

Boolean DtEditorChange(Widget widget,
	DtEditorChangeValues *findChangeStrings,
	unsigned int instanceToChange);

Boolean DtEditorCheckForUnsavedChanges(Widget widget);

Boolean DtEditorClearSelection(Widget widget);

Boolean DtEditorCopyToClipboard(Widget widget);

Boolean DtEditorCutToClipboard(Widget widget);

Boolean DtEditorDeleteSelection(Widget widget);

Boolean DtEditorDeselect(Widget widget);

void DtEditorDisableRedisplay(Widget widget);

void DtEditorEnableRedisplay(Widget widget);

Boolean DtEditorFind(Widget widget,
	char * find);

DtEditorErrorCode DtEditorFormat(Widget widget,
	DtEditorFormatSettings *formatSettings,
	unsigned int amountToFormat);

DtEditorErrorCode DtEditorGetContents(Widget widget,
	DtEditorContentRec *data,
	Boolean	hardCarriageReturns,
	Boolean markContentsAsSaved);

XmTextPosition DtEditorGetInsertionPosition(Widget widget);

XmTextPosition DtEditorGetLastPosition(Widget widget);

Widget DtEditorGetMessageTextFieldID(Widget widget);

void DtEditorGetSizeHints(Widget widget,
	XSizeHints *pHints);

void DtEditorGoToLine(Widget widget,
	int lineNumber);

DtEditorErrorCode DtEditorInsert(Widget widget,
	DtEditorContentRec *data);

DtEditorErrorCode DtEditorInsertFromFile(Widget widget,
	char *fileName);

void DtEditorInvokeFindChangeDialog(Widget widget);

void DtEditorInvokeFormatDialog(Widget widget);

DtEditorErrorCode DtEditorInvokeSpellDialog(Widget widget);

Boolean DtEditorPasteFromClipboard(Widget widget);

DtEditorErrorCode DtEditorReplace(Widget widget,
	XmTextPosition startPos,
	XmTextPosition endPos,
	DtEditorContentRec *data);

DtEditorErrorCode DtEditorReplaceFromFile(Widget widget,
	XmTextPosition startPos,
	XmTextPosition endPos,
	char *fileName);

void DtEditorReset(Widget widget);

DtEditorErrorCode DtEditorSaveContentsToFile(Widget widget,
	char *fileName,
	Boolean	overwriteIfExists,
	Boolean	hardCarriageReturns,
	Boolean markContentsAsSaved);

Boolean DtEditorSelectAll(Widget widget);

DtEditorErrorCode DtEditorSetContents(Widget widget,
	DtEditorContentRec *data);

DtEditorErrorCode DtEditorSetContentsFromFile(Widget widget,
	char *fileName);

void DtEditorSetInsertionPosition(Widget widget,
		XmTextPosition position);

void DtEditorTraverseToEditor(Widget widget);

Boolean DtEditorUndoEdit(Widget widget);

SEE ALSO
DtCreateEditor(3), DtEditor(3), DtEditorAppend(3), DtEditorAppendFromFile(3), DtEditorChange(3), DtEditorCheckForUnsavedChanges(3), DtEditorClearSelection(3), DtEditorCopyToClipboard(3), DtEditorCutToClipboard(3), DtEditorDeleteSelection(3), DtEditorDeselect(3), DtEditorFind(3), DtEditorFormat(3), DtEditorGetContents(3), DtEditorGetInsertionPosition(3), DtEditorGetLastPosition(3), DtEditorGetMessageTextFieldID(3), DtEditorGetSizeHints(3), DtEditorGoToLine(3), DtEditorInsert(3), DtEditorInsertFromFile(3), DtEditorInvokeFindChangeDialog(3), DtEditorInvokeFormatDialog(3), DtEditorInvokeSpellDialog(3), DtEditorPasteFromClipboard(3), DtEditorReplace(3), DtEditorReplaceFromFile(3), DtEditorReset(3), DtEditorSaveContentsToFile(3), DtEditorSelectAll(3), DtEditorSetContents(3), DtEditorSetContentsFromFile(3), DtEditorSetInsertionPosition(3), DtEditorTraverseToEditor(3), DtEditorUndoEdit(3).