Workaround for KDE's FONTLIST bug (and for the various
[nedit.git] / source / text.h
blobd312937e02d33d313b10a1b06429842c4833bc44
1 /* $Id: text.h,v 1.17 2003/05/16 16:47:21 slobasso Exp $ */
3 #ifndef NEDIT_TEXT_H_INCLUDED
4 #define NEDIT_TEXT_H_INCLUDED
6 #include "textBuf.h"
8 #include <X11/Intrinsic.h>
9 #include <X11/X.h>
10 #include <X11/Xlib.h>
12 /* Resource strings */
13 #define textNfont "font"
14 #define textCFont "Font"
15 #define textNrows "rows"
16 #define textCRows "Rows"
17 #define textNcolumns "columns"
18 #define textCColumns "Columns"
19 #define textNmarginWidth "marginWidth"
20 #define textCMarginWidth "MarginWidth"
21 #define textNmarginHeight "marginHeight"
22 #define textCMarginHeight "MarginHeight"
23 #define textNselectForeground "selectForeground"
24 #define textCSelectForeground "SelectForeground"
25 #define textNselectBackground "selectBackground"
26 #define textCSelectBackground "SelectBackground"
27 #define textNhighlightForeground "highlightForeground"
28 #define textCHighlightForeground "HighlightForeground"
29 #define textNhighlightBackground "highlightBackground"
30 #define textCHighlightBackground "HighlightBackground"
31 #define textNcursorForeground "cursorForeground"
32 #define textCCursorForeground "CursorForeground"
33 #define textNlineNumForeground "lineNumForeground"
34 #define textCLineNumForeground "LineNumForeground"
35 #define textNcalltipForeground "calltipForeground"
36 #define textCcalltipForeground "CalltipForeground"
37 #define textNcalltipBackground "calltipBackground"
38 #define textCcalltipBackground "CalltipBackground"
39 #define textNpendingDelete "pendingDelete"
40 #define textCPendingDelete "PendingDelete"
41 #define textNhScrollBar "hScrollBar"
42 #define textCHScrollBar "HScrollBar"
43 #define textNvScrollBar "vScrollBar"
44 #define textCVScrollBar "VScrollBar"
45 #define textNlineNumCols "lineNumCols"
46 #define textCLineNumCols "LineNumCols"
47 #define textNautoShowInsertPos "autoShowInsertPos"
48 #define textCAutoShowInsertPos "AutoShowInsertPos"
49 #define textNautoWrapPastedText "autoWrapPastedText"
50 #define textCAutoWrapPastedText "AutoWrapPastedText"
51 #define textNwordDelimiters "wordDelimiters"
52 #define textCWordDelimiters "WordDelimiters"
53 #define textNblinkRate "blinkRate"
54 #define textCBlinkRate "BlinkRate"
55 #define textNfocusCallback "focusCallback"
56 #define textCFocusCallback "FocusCallback"
57 #define textNlosingFocusCallback "losingFocusCallback"
58 #define textCLosingFocusCallback "LosingFocusCallback"
59 #define textNcursorMovementCallback "cursorMovementCallback"
60 #define textCCursorMovementCallback "CursorMovementCallback"
61 #define textNdragStartCallback "dragStartCallback"
62 #define textCDragStartCallback "DragStartCallback"
63 #define textNdragEndCallback "dragEndCallback"
64 #define textCDragEndCallback "DragEndCallback"
65 #define textNsmartIndentCallback "smartIndentCallback"
66 #define textCSmartIndentCallback "SmartIndentCallback"
67 #define textNautoWrap "autoWrap"
68 #define textCAutoWrap "AutoWrap"
69 #define textNcontinuousWrap "continuousWrap"
70 #define textCContinuousWrap "ContinuousWrap"
71 #define textNwrapMargin "wrapMargin"
72 #define textCWrapMargin "WrapMargin"
73 #define textNautoIndent "autoIndent"
74 #define textCAutoIndent "AutoIndent"
75 #define textNsmartIndent "smartIndent"
76 #define textCSmartIndent "SmartIndent"
77 #define textNoverstrike "overstrike"
78 #define textCOverstrike "Overstrike"
79 #define textNheavyCursor "heavyCursor"
80 #define textCHeavyCursor "HeavyCursor"
81 #define textNreadOnly "readOnly"
82 #define textCReadOnly "ReadOnly"
83 #define textNhidePointer "hidePointer"
84 #define textCHidePointer "HidePointer"
85 #define textNemulateTabs "emulateTabs"
86 #define textCEmulateTabs "EmulateTabs"
87 #define textNcursorVPadding "cursorVPadding"
88 #define textCCursorVPadding "CursorVPadding"
89 #define textNbacklightCharTypes "backlightCharTypes"
90 #define textCBacklightCharTypes "BacklightCharTypes"
93 extern WidgetClass textWidgetClass;
95 struct _TextClassRec;
96 struct _TextRec;
98 typedef struct _TextClassRec *TextWidgetClass;
99 typedef struct _TextRec *TextWidget;
101 typedef struct {
102 int startPos;
103 int nCharsDeleted;
104 int nCharsInserted;
105 char *deletedText;
106 } dragEndCBStruct;
108 enum smartIndentCallbackReasons {NEWLINE_INDENT_NEEDED, CHAR_TYPED};
109 typedef struct {
110 int reason;
111 int pos;
112 int indentRequest;
113 char *charsTyped;
114 } smartIndentCBStruct;
116 /* User callable routines */
117 void TextSetBuffer(Widget w, textBuffer *buffer);
118 textBuffer *TextGetBuffer(Widget w);
119 int TextLineAndColToPos(Widget w, int lineNum, int column);
120 int TextPosToLineAndCol(Widget w, int pos, int *lineNum, int *column);
121 int TextPosToXY(Widget w, int pos, int *x, int *y);
122 int TextGetCursorPos(Widget w);
123 void TextSetCursorPos(Widget w, int pos);
124 void TextGetScroll(Widget w, int *topLineNum, int *horizOffset);
125 void TextSetScroll(Widget w, int topLineNum, int horizOffset);
126 int TextGetMinFontWidth(Widget w, Boolean considerStyles);
127 int TextGetMaxFontWidth(Widget w, Boolean considerStyles);
128 void TextHandleXSelections(Widget w);
129 void TextStopHandlingSelections(Widget w);
130 void TextPasteClipboard(Widget w, Time time);
131 void TextColPasteClipboard(Widget w, Time time);
132 void TextCopyClipboard(Widget w, Time time);
133 void TextCutClipboard(Widget w, Time time);
134 int TextFirstVisibleLine(Widget w);
135 int TextNumVisibleLines(Widget w);
136 int TextVisibleWidth(Widget w);
137 void TextInsertAtCursor(Widget w, char *chars, XEvent *event,
138 int allowPendingDelete, int allowWrap);
139 int TextFirstVisiblePos(Widget w);
140 int TextLastVisiblePos(Widget w);
141 char *TextGetWrapped(Widget w, int startPos, int endPos, int *length);
142 XtActionsRec *TextGetActions(int *nActions);
143 void ShowHidePointer(TextWidget w, Boolean hidePointer);
145 #ifdef VMS /* VMS linker doesn't like long names (>31 chars) */
146 #define HandleAllPendingGraphicsExposeNoExposeEvents HandlePendingExpNoExpEvents
147 #endif /* VMS */
149 void HandleAllPendingGraphicsExposeNoExposeEvents(TextWidget w, XEvent *event);
151 #endif /* NEDIT_TEXT_H_INCLUDED */