Fix for SF bug #1060749: focusWindowMS (macro.c) causes crash.
[nedit.git] / source / text.h
blob6203928f813e91acb31737a82af5c8ac9ffbfb4f
1 /* $Id: text.h,v 1.22 2004/10/08 21:55:51 yooden Exp $ */
2 /*******************************************************************************
3 * *
4 * text.h -- Nirvana Editor Text Widget Header File *
5 * *
6 * Copyright 2003 The NEdit Developers *
7 * *
8 * This is free software; you can redistribute it and/or modify it under the *
9 * terms of the GNU General Public License as published by the Free Software *
10 * Foundation; either version 2 of the License, or (at your option) any later *
11 * version. In addition, you may distribute version of this program linked to *
12 * Motif or Open Motif. See README for details. *
13 * *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
17 * for more details. *
18 * *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * *
23 * Nirvana Text Editor *
24 * July 31, 2001 *
25 * *
26 *******************************************************************************/
28 #ifndef NEDIT_TEXT_H_INCLUDED
29 #define NEDIT_TEXT_H_INCLUDED
31 #include "textBuf.h"
33 #include <X11/Intrinsic.h>
34 #include <X11/X.h>
35 #include <X11/Xlib.h>
37 /* Resource strings */
38 #define textNfont "font"
39 #define textCFont "Font"
40 #define textNrows "rows"
41 #define textCRows "Rows"
42 #define textNcolumns "columns"
43 #define textCColumns "Columns"
44 #define textNmarginWidth "marginWidth"
45 #define textCMarginWidth "MarginWidth"
46 #define textNmarginHeight "marginHeight"
47 #define textCMarginHeight "MarginHeight"
48 #define textNselectForeground "selectForeground"
49 #define textCSelectForeground "SelectForeground"
50 #define textNselectBackground "selectBackground"
51 #define textCSelectBackground "SelectBackground"
52 #define textNhighlightForeground "highlightForeground"
53 #define textCHighlightForeground "HighlightForeground"
54 #define textNhighlightBackground "highlightBackground"
55 #define textCHighlightBackground "HighlightBackground"
56 #define textNcursorForeground "cursorForeground"
57 #define textCCursorForeground "CursorForeground"
58 #define textNlineNumForeground "lineNumForeground"
59 #define textCLineNumForeground "LineNumForeground"
60 #define textNcalltipForeground "calltipForeground"
61 #define textCcalltipForeground "CalltipForeground"
62 #define textNcalltipBackground "calltipBackground"
63 #define textCcalltipBackground "CalltipBackground"
64 #define textNpendingDelete "pendingDelete"
65 #define textCPendingDelete "PendingDelete"
66 #define textNhScrollBar "hScrollBar"
67 #define textCHScrollBar "HScrollBar"
68 #define textNvScrollBar "vScrollBar"
69 #define textCVScrollBar "VScrollBar"
70 #define textNlineNumCols "lineNumCols"
71 #define textCLineNumCols "LineNumCols"
72 #define textNautoShowInsertPos "autoShowInsertPos"
73 #define textCAutoShowInsertPos "AutoShowInsertPos"
74 #define textNautoWrapPastedText "autoWrapPastedText"
75 #define textCAutoWrapPastedText "AutoWrapPastedText"
76 #define textNwordDelimiters "wordDelimiters"
77 #define textCWordDelimiters "WordDelimiters"
78 #define textNblinkRate "blinkRate"
79 #define textCBlinkRate "BlinkRate"
80 #define textNfocusCallback "focusCallback"
81 #define textCFocusCallback "FocusCallback"
82 #define textNlosingFocusCallback "losingFocusCallback"
83 #define textCLosingFocusCallback "LosingFocusCallback"
84 #define textNcursorMovementCallback "cursorMovementCallback"
85 #define textCCursorMovementCallback "CursorMovementCallback"
86 #define textNdragStartCallback "dragStartCallback"
87 #define textCDragStartCallback "DragStartCallback"
88 #define textNdragEndCallback "dragEndCallback"
89 #define textCDragEndCallback "DragEndCallback"
90 #define textNsmartIndentCallback "smartIndentCallback"
91 #define textCSmartIndentCallback "SmartIndentCallback"
92 #define textNautoWrap "autoWrap"
93 #define textCAutoWrap "AutoWrap"
94 #define textNcontinuousWrap "continuousWrap"
95 #define textCContinuousWrap "ContinuousWrap"
96 #define textNwrapMargin "wrapMargin"
97 #define textCWrapMargin "WrapMargin"
98 #define textNautoIndent "autoIndent"
99 #define textCAutoIndent "AutoIndent"
100 #define textNsmartIndent "smartIndent"
101 #define textCSmartIndent "SmartIndent"
102 #define textNoverstrike "overstrike"
103 #define textCOverstrike "Overstrike"
104 #define textNheavyCursor "heavyCursor"
105 #define textCHeavyCursor "HeavyCursor"
106 #define textNreadOnly "readOnly"
107 #define textCReadOnly "ReadOnly"
108 #define textNhidePointer "hidePointer"
109 #define textCHidePointer "HidePointer"
110 #define textNemulateTabs "emulateTabs"
111 #define textCEmulateTabs "EmulateTabs"
112 #define textNcursorVPadding "cursorVPadding"
113 #define textCCursorVPadding "CursorVPadding"
114 #define textNbacklightCharTypes "backlightCharTypes"
115 #define textCBacklightCharTypes "BacklightCharTypes"
118 extern WidgetClass textWidgetClass;
120 struct _TextClassRec;
121 struct _TextRec;
123 typedef struct _TextClassRec *TextWidgetClass;
124 typedef struct _TextRec *TextWidget;
126 typedef struct {
127 int startPos;
128 int nCharsDeleted;
129 int nCharsInserted;
130 char *deletedText;
131 } dragEndCBStruct;
133 enum smartIndentCallbackReasons {NEWLINE_INDENT_NEEDED, CHAR_TYPED};
134 typedef struct {
135 int reason;
136 int pos;
137 int indentRequest;
138 char *charsTyped;
139 } smartIndentCBStruct;
141 /* User callable routines */
142 void TextSetBuffer(Widget w, textBuffer *buffer);
143 textBuffer *TextGetBuffer(Widget w);
144 int TextLineAndColToPos(Widget w, int lineNum, int column);
145 int TextPosToLineAndCol(Widget w, int pos, int *lineNum, int *column);
146 int TextPosToXY(Widget w, int pos, int *x, int *y);
147 int TextGetCursorPos(Widget w);
148 void TextSetCursorPos(Widget w, int pos);
149 void TextGetScroll(Widget w, int *topLineNum, int *horizOffset);
150 void TextSetScroll(Widget w, int topLineNum, int horizOffset);
151 int TextGetMinFontWidth(Widget w, Boolean considerStyles);
152 int TextGetMaxFontWidth(Widget w, Boolean considerStyles);
153 void TextHandleXSelections(Widget w);
154 void TextStopHandlingSelections(Widget w);
155 void TextPasteClipboard(Widget w, Time time);
156 void TextColPasteClipboard(Widget w, Time time);
157 void TextCopyClipboard(Widget w, Time time);
158 void TextCutClipboard(Widget w, Time time);
159 int TextFirstVisibleLine(Widget w);
160 int TextNumVisibleLines(Widget w);
161 int TextVisibleWidth(Widget w);
162 void TextInsertAtCursor(Widget w, char *chars, XEvent *event,
163 int allowPendingDelete, int allowWrap);
164 int TextFirstVisiblePos(Widget w);
165 int TextLastVisiblePos(Widget w);
166 char *TextGetWrapped(Widget w, int startPos, int endPos, int *length);
167 const char *GetDefaultTranslations(void);
168 XtActionsRec *TextGetActions(int *nActions);
169 void ShowHidePointer(TextWidget w, Boolean hidePointer);
170 void ResetCursorBlink(TextWidget textWidget, Boolean startsBlanked);
172 #ifdef VMS /* VMS linker doesn't like long names (>31 chars) */
173 #define HandleAllPendingGraphicsExposeNoExposeEvents HandlePendingExpNoExpEvents
174 #endif /* VMS */
176 void HandleAllPendingGraphicsExposeNoExposeEvents(TextWidget w, XEvent *event);
178 #endif /* NEDIT_TEXT_H_INCLUDED */