summaryrefslogtreecommitdiffstats
path: root/qt/qextscintilla.h
blob: f36079ec65c9ae63bfeb0cd98ddd5f1538886a22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
// This module defines the "official" high-level API of the TQt port of
// Scintilla.
//
// Copyright (c) 2006
// 	Riverbank Computing Limited <info@riverbankcomputing.co.uk>
// 
// This file is part of TQScintilla.
// 
// This copy of TQScintilla is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option) any
// later version.
// 
// TQScintilla is supplied in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
// details.
// 
// You should have received a copy of the GNU General Public License along with
// TQScintilla; see the file LICENSE.  If not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


#ifndef TQEXTSCINTILLA_H
#define TQEXTSCINTILLA_H


#include <tqobject.h>
#include <tqguardedptr.h>

#include <qextscintillaglobal.h>
#include <qextscintillabase.h>
#include <qextscintilladocument.h>


class QextScintillaLexer;
class QextScintillaAPIs;
class QextScintillaCommandSet;


//! \brief The QextScintilla class implements a higher level, more TQt-like,
//! API to the Scintilla editor widget.
//!
//! QextScintilla implements methods, signals and slots similar to those found
//! in other TQt editor classes. It also provides a higher level interface to
//! features specific to Scintilla such as syntax styling, call tips,
//! auto-indenting and auto-completion than that provided by QextScintillaBase.
//!
//! The API is modelled on TQTextEdit - a method of the same name should behave
//! in the same way.
class TQEXTSCINTILLA_EXPORT QextScintilla : public QextScintillaBase
{
	TQ_OBJECT
  

public:
	//! This enum defines the different auto-indentation styles.
	enum {
		//! A line is automatically indented to match the previous
		//! line.
		AiMaintain = 0x01,

		//! If the language supported by the current lexer has a
		//! specific start of block character (e.g. { in C++), then a
		//! line that begins with that character is indented as well as
		//! the lines that make up the block.  It may be logically ored
		//! with AiClosing.
		AiOpening = 0x02,

		//! If the language supported by the current lexer has a
		//! specific end of block character (e.g. } in C++), then a
		//! line that begins with that character is indented as well as
		//! the lines that make up the block.  It may be logically ored
		//! with AiOpening.
		AiClosing = 0x04
	};

	//! This enum defines the different sources for auto-completion lists.
	enum AutoCompletionSource {
		//! The source is the current document.
		AcsDocument,

		//! The source is any installed APIs.
		AcsAPIs,

		//! The source is all available sources.
		AcsAll
	};

	//! This enum defines the different brace matching modes.  The
	//! character pairs {}, [] and () are treated as braces.  The Python
	//! lexer will also match a : with the end of the corresponding
	//! indented block.
	enum BraceMatch {
		//! Brace matching is disabled.
		NoBraceMatch,

		//! Brace matching is enabled for a brace immediately before
		//! the current position.
		StrictBraceMatch,

		//! Brace matching is enabled for a brace immediately before or
		//! after the current position.
		SloppyBraceMatch
	};

	//! This enum defines the different edge modes for long lines.
	enum EdgeMode {
		//! Long lines are not marked.
		EdgeNone = EDGE_NONE,

		//! A vertical line is drawn at the column set by
		//! setEdgeColumn().  This is recommended for monospace fonts.
		EdgeLine = EDGE_LINE,

		//! The background color of characters after the column limit
		//! is changed to the color set by setEdgeColor().  This is
		//! recommended for proportional fonts.
		EdgeBackground = EDGE_BACKGROUND
	};

	//! This enum defines the different end-of-line modes.
	enum EolMode {
		//! A carriage return/line feed as used on Windows systems.
		EolWindows = SC_EOL_CRLF,

		//! A line feed as used on Unix systems.
		EolUnix = SC_EOL_LF,

		//! A carriage return as used on Mac systems.
		EolMac = SC_EOL_CR
	};

	//! This enum defines the different styles for the folding margin.
	enum FoldStyle {
		//! Folding is disabled.
		NoFoldStyle,

		//! Plain folding style using plus and minus symbols.
		PlainFoldStyle,

		//! Circled folding style using circled plus and minus symbols.
		CircledFoldStyle,

		//! Boxed folding style using boxed plus and minus symbols.
		BoxedFoldStyle,

		//! Circled tree style using a flattened tree with circled plus
		//! and minus symbols and rounded corners.
		CircledTreeFoldStyle,

		//! Boxed tree style using a flattened tree with boxed plus and
		//! minus symbols and right-angled corners.
		BoxedTreeFoldStyle
	};

	//! This enum defines the different pre-defined marker symbols.
	enum MarkerSymbol {
		//! A circle.
		Circle = SC_MARK_CIRCLE,

		//! A rectangle.
		Rectangle = SC_MARK_ROUNDRECT,

		//! A triangle pointing to the right.
		RightTriangle = SC_MARK_ARROW,

		//! A smaller rectangle.
		SmallRectangle = SC_MARK_SMALLRECT,

		//! An arrow pointing to the right.
		RightArrow = SC_MARK_SHORTARROW,

		//! An invisible marker that allows code to track the movement
		//! of lines.
		Invisible = SC_MARK_EMPTY,

		//! A triangle pointing down.
		DownTriangle = SC_MARK_ARROWDOWN,

		//! A drawn minus sign.
		Minus = SC_MARK_MINUS,

		//! A drawn plus sign.
		Plus = SC_MARK_PLUS,

		//! A vertical line drawn in the background colour.
		VerticalLine = SC_MARK_VLINE,

		//! A bottom left corner drawn in the background colour.
		BottomLeftCorner = SC_MARK_LCORNER,

		//! A vertical line with a centre right horizontal line drawn
		//! in the background colour.
		LeftSideSplitter = SC_MARK_TCORNER,

		//! A drawn plus sign in a box.
		BoxedPlus = SC_MARK_BOXPLUS,

		//! A drawn plus sign in a connected box.
		BoxedPlusConnected = SC_MARK_BOXPLUSCONNECTED,

		//! A drawn minus sign in a box.
		BoxedMinus = SC_MARK_BOXMINUS,

		//! A drawn minus sign in a connected box.
		BoxedMinusConnected = SC_MARK_BOXMINUSCONNECTED,

		//! A rounded bottom left corner drawn in the background
		//! colour.
		RoundedBottomLeftCorner = SC_MARK_LCORNERCURVE,

		//! A vertical line with a centre right curved line drawn in
		//! the background colour.
		LeftSideRoundedSplitter = SC_MARK_TCORNERCURVE,

		//! A drawn plus sign in a circle.
		CircledPlus = SC_MARK_CIRCLEPLUS,

		//! A drawn plus sign in a connected box.
		CircledPlusConnected = SC_MARK_CIRCLEPLUSCONNECTED,

		//! A drawn minus sign in a circle.
		CircledMinus = SC_MARK_CIRCLEMINUS,

		//! A drawn minus sign in a connected circle.
		CircledMinusConnected = SC_MARK_CIRCLEMINUSCONNECTED,

		//! No symbol is drawn but the line of text is drawn with the
		//! same background colour.
		Background = SC_MARK_BACKGROUND,

		//! Three drawn dots.
		ThreeDots = SC_MARK_DOTDOTDOT,

		//! Three drawn arrows pointing right.
		ThreeRightArrows = SC_MARK_ARROWS
	};

	//! This enum defines the different whitespace visibility modes.  When
	//! whitespace is visible spaces are displayed as small centred dots
	//! and tabs are displayed as light arrows pointing to the right.
	enum WhitespaceVisibility {
		//! Whitespace is invisible.
		WsInvisible = SCWS_INVISIBLE,

		//! Whitespace is always visible.
		WsVisible = SCWS_VISIBLEALWAYS,

		//! Whitespace is visible after the whitespace used for
		//! indentation.
		WsVisibleAfterIndent = SCWS_VISIBLEAFTERINDENT
	};

	//! This enum defines the different line wrap modes.
	enum WrapMode {
		//! Lines are not wrapped.
		WrapNone = SC_WRAP_NONE,

		//! Lines are wrapped at word boundaries.
		WrapWord = SC_WRAP_WORD,

		//! Lines are wrapped at character boundaries.
		WrapCharacter = SC_WRAP_CHAR
        };

	//! This enum defines the different line wrap visual flags.
	enum WrapVisualFlag {
		//! No wrap flag is displayed.
		WrapFlagNone,

		//! A wrap flag is displayed by the text.
		WrapFlagByText,

		//! A wrap flag is displayed by the border.
		WrapFlagByBorder
	};

	//! Construct an empty QextScintilla with parent \a parent, name \a
	//! name, and widget flags \a f.
	QextScintilla(TQWidget *parent = 0,const char *name = 0,WFlags f = 0);

	//! Destroys the QextScintilla instance.
	virtual ~QextScintilla();

	//! Returns TRUE if auto-completion lists are case sensitive.
	//!
	//! \sa setAutoCompletionCaseSensitivity()
	bool autoCompletionCaseSensitivity();

    //! Returns true if auto-completion fill-up characters are enabled.
    //!
    //! \sa setAutoCompletionFillups(), setAutoCompletionFillupsEnabled()
    bool autoCompletionFillupsEnabled();

	//! Returns TRUE if the rest of the word to the right of the current
	//! cursor is removed when an item from an auto-completion list is
	//! selected.
	//!
	//! \sa setAutoCompletionReplaceWord()
	bool autoCompletionReplaceWord();

	//! Returns TRUE if the only item in an auto-completion list with a
	//! single entry is automatically used and the list not displayed.
	//!
	//! \sa setAutoCompletionShowSingle()
	bool autoCompletionShowSingle();

	//! Returns the current source for the auto-completion list when it is
	//! being displayed automatically as the user types.
	//!
	//! \sa setAutoCompletionSource()
	AutoCompletionSource autoCompletionSource() const {return acSource;}

	//! Returns the current threshold for the automatic display of the
	//! auto-completion list as the user types.
	//!
	//! \sa setAutoCompletionThreshold()
	int autoCompletionThreshold() const {return acThresh;}

	//! Returns TRUE if auto-indentation is enabled.
	//!
	//! \sa setAutoIndent()
	bool autoIndent() const {return autoInd;}

	//! Returns TRUE if the backspace key unindents a line instead of
	//! deleting a character.  The default is FALSE.
	//!
	//! \sa setBackspaceUnindents(), tabIndents(), setTabIndents()
	bool backspaceUnindents();

	//! Mark the beginning of a sequence of actions that can be undone by
	//! a single call to undo().
	//!
	//! \sa endUndoAction(), undo()
	void beginUndoAction();

	//! Returns the brace matching mode.
	//!
	//! \sa setBraceMatching()
	BraceMatch braceMatching() const {return braceMode;}

	//! Returns the maximum number of call tips that are displayed.
	//!
	//! \sa setCallTipsVisible()
	int callTipsVisible() const {return maxCallTips;}

	//! Cancel any current auto-completion or user defined list.
	void cancelList();

	//! Clear all registered images.
	//!
	//! \sa registerImage()
	void clearRegisteredImages();

	//! All the lines of the text have their end-of-lines converted to mode
	//! \a mode.
	//!
	//! \sa eolMode(), setEolMode()
	void convertEols(EolMode mode);

	//! Returns the widget's text (ie. foreground) colour.
	//!
	//! \sa setColor()
	TQColor color() const;

	//! Returns the attached document.
	//!
	//! \sa setDocument()
	QextScintillaDocument document() {return doc;}

	//! Mark the end of a sequence of actions that can be undone by a
	//! single call to undo().
	//!
	//! \sa beginUndoAction(), undo()
	void endUndoAction();

	//! Returns the color of the marker used to show that a line has
	//! exceeded the length set by setEdgeColumn().
	//!
	//! \sa setEdgeColor(), \sa setEdgeColumn
	TQColor edgeColor();

	//! Returns the number of the column after which lines are considered
	//! to be long.
	//!
	//! \sa setEdgeColumn()
	int edgeColumn();

	//! Returns the edge mode which determines how long lines are marked.
	//!
	//! \sa setEdgeMode()
	EdgeMode edgeMode();

	//! Returns the end-of-line mode.
	//!
	//! \sa setEolMode()
	EolMode eolMode();

	//! Returns the visibility of end-of-lines.
	//!
	//! \sa setEolVisibility()
	bool eolVisibility();

	//! Find the next occurrence of the string \a expr and return TRUE if
	//! \a expr was found, otherwise returns FALSE.  If \a expr is found it
	//! becomes the current selection.
	//!
	//! If \a re is TRUE then \a expr is interpreted as a regular
	//! expression rather than a simple string.
	//!
	//! If \a cs is TRUE then the search is case sensitive.
	//!
	//! If \a wo is TRUE then the search looks for whole word matches only,
	//! otherwise it searches for any matching text.
	//!
	//! If \a wrap is TRUE then the search wraps around the end of the
	//! text.
	//!
	//! If \a forward is TRUE (the default) then the search is forward from
	//! the starting position to the end of the text, otherwise it is
	//! backwards to the beginning of the text. 
	//!
	//! If either \a line or \a index are negative (the default) then the
	//! search begins from the current cursor position.  Otherwise the
	//! search begins at position \a index of line \a line.
	//!
	//! If \a show is TRUE (the default) then any text found is made
	//! visible (ie. it is unfolded).
	//!
	//! \sa findNext(), replace()
	virtual bool findFirst(const TQString &expr,bool re,bool cs,bool wo,
			       bool wrap,bool forward = TRUE,int line = -1,
			       int index = -1,bool show = TRUE);

	//! Find the next occurence of the string found using findFirst().
	//!
	//! \sa findFirst(), replace()
	virtual bool findNext();

	//! Returns the number of the first visible line.
	int firstVisibleLine();

	//! Returns the current folding style.
	//!
	//! \sa setFolding()
	FoldStyle folding() const {return fold;}

	//! Sets \a *line and \a *index to the line and index of the cursor.
	//!
	//! \sa setCursorPosition()
	void getCursorPosition(int *line,int *index);

	//! If there is a selection, \a *lineFrom is set to the line number in
	//! which the selection begins and \a *lineTo is set to the line number
	//! in which the selection ends.  (They could be the same.)
	//! \a *indexFrom is set to the index at which the selection begins
	//! within \a *lineFrom, and \a *indexTo is set to the index at which
	//! the selection ends within \a *lineTo.  If there is no selection,
	//! \a *lineFrom, \a *indexFrom, \a *lineTo and \a *indexTo are all set
	//! to -1. 
	//!
	//! \sa setSelection()
	void getSelection(int *lineFrom,int *indexFrom,
			  int *lineTo,int *indexTo);

	//! Returns TRUE if some text is selected.
	//!
	//! \sa selectedText()
	bool hasSelectedText() const {return selText;}

	//! Returns the number of characters that line \a line is indented by.
	//!
	//! \sa setIndentation()
	int indentation(int line);

	//! Returns TRUE if the display of indentation guides is enabled.
	//!
	//! \sa setIndentationGuides()
	bool indentationGuides();

	//! Returns TRUE if indentations are created using tabs and spaces,
	//! rather than just spaces.  The default is TRUE.
	//!
	//! \sa setIndentationsUseTabs()
	bool indentationsUseTabs();

	//! Returns the indentation width in characters.  The default is 0
	//! which means that the value returned by tabWidth() is actually used.
	//!
	//! \sa setIndentationWidth(), tabWidth()
	int indentationWidth();

	//! Returns TRUE if a call tip is currently active.
	bool isCallTipActive();

	//! Returns TRUE if an auto-completion or user defined list is
	//! currently active.
	bool isListActive();

	//! Returns TRUE if the text has been modified.
	//!
	//! \sa setModified(), modificationChanged()
	bool isModified();

	//! Returns TRUE if the text edit is read-only.
	//!
	//! \sa setReadOnly()
	bool isReadOnly();

	//! Returns TRUE if there is something that can be redone.
	//!
	//! \sa redo()
	bool isRedoAvailable();

	//! Returns TRUE if there is something that can be undone.
	//!
	//! \sa undo()
	bool isUndoAvailable();

	//! Returns TRUE if text is interpreted as being UTF8 encoded.  The
	//! default is to interpret the text as Latin1 encoded.
	//!
	//! \sa setUtf8()
	bool isUtf8();

	//! Returns the line which is at position \a pos or -1 if there is no
	//! line at that position.
	int lineAt(const TQPoint &pos);

	//! Returns the length of line \a line or -1 if there is no such line.
	int lineLength(int line);

	//! Returns the number of lines of text.
	int lines();

	//! Returns the length of the text edit's text.
	int length();

	//! Returns the current language lexer used to style text.  If it is 0 then
	//! syntax styling is disabled.
	//!
	//! \sa setLexer()
	QextScintillaLexer *lexer() const;

	//! Returns TRUE if line numbers are enabled for margin \a margin.
	//!
	//! \sa setMarginLineNumbers(), QextScintillaBase::SCI_GETMARGINTYPEN
	bool marginLineNumbers(int margin);

	//! Returns the marker mask of margin \a margin.
	//!
	//! \sa setMarginMask(), QextScintillaMarker,
	//! QextScintillaBase::SCI_GETMARGINMASKN
	int marginMarkerMask(int margin);

	//! Returns TRUE if margin \a margin is sensitive to mouse clicks.
	//!
	//! \sa setMarginSensitivity(), marginClicked(),
	//! QextScintillaBase::SCI_GETMARGINTYPEN
	bool marginSensitivity(int margin);

	//! Returns the width in pixels of margin \a margin.
	//!
	//! \sa setMarginWidth(), QextScintillaBase::SCI_GETMARGINWIDTHN
	int marginWidth(int margin);

	//! Define a marker using the symbol \a sym with the marker number
	//! \a mnr.  If \a mnr is -1 then the marker number is automatically
	//! allocated.  The marker number is returned or -1 if the marker
	//! number was already allocated or too many markers have been defined.
	//!
	//! Markers are small geometric symbols and character used, for
	//! example, to indicate the current line or, in debuggers, to indicate
	//! breakpoints.  If a margin has a width of 0 then its markers are not
	//! drawn, but their background colours affect the background colour of
	//! the corresponding line of text.
	//!
	//! There may be up to 32 markers defined and each line of text has a
	//! set of these markers associated with it.  Markers are drawn
	//! according to their numerical identifier.  Markers try to move with
	//! their text by tracking where the start of their line moves to.  For
	//! example, when a line is deleted its markers are added to previous
	//! line's markers.
	//!
	//! Each marker is identified by a marker number.  Each instance of a
	//! marker is identified by a marker handle.
	int markerDefine(MarkerSymbol sym,int mnr = -1);

	//! Define a marker using the character \a ch with the marker number
	//! \a mnr.  If \a mnr is -1 then the marker number is automatically
	//! allocated.  The marker number is returned or -1 if the marker
	//! number was already allocated or too many markers have been defined.
	int markerDefine(char ch,int mnr = -1);

	//! Define a marker using a copy of the pixmap \a pm with the marker
	//! number \a mnr.  If \a mnr is -1 then the marker number is
	//! automatically allocated.  The marker number is returned or -1 if
	//! the marker number was already allocated or too many markers have
	//! been defined.
	int markerDefine(const TQPixmap *pm,int mnr = -1);

	//! Add a marker number \a mnr to line number \a linenr.  A handle for
	//! the marker is returned which can be used to track the marker's
	//! position, or -1 if the \a mnr was invalid.
	//!
	//! \sa markerDelete(), markerDeleteAll(), markerDeleteHandle()
	int markerAdd(int linenr,int mnr);

	//! Returns the 32 bit mask of marker numbers at line number \a linenr.
	//!
	//! \sa markerAdd()
	unsigned markersAtLine(int linenr);

	//! Delete all markers with the marker number \a mnr in the line
	//! \a linenr.  If \a mnr is -1 then delete all markers from line
	//! \a linenr.
	//!
	//! \sa markerAdd(), markerDeleteAll(), markerDeleteHandle()
	void markerDelete(int linenr,int mnr = -1);

	//! Delete the all markers with the marker number \a mnr.  If \a mnr is
	//! -1 then delete all markers.
	//!
	//! \sa markerAdd(), markerDelete(), markerDeleteHandle()
	void markerDeleteAll(int mnr = -1);

	//! Delete the the marker instance with the marker handle \a mhandle.
	//!
	//! \sa markerAdd(), markerDelete(), markerDeleteAll()
	void markerDeleteHandle(int mhandle);

	//! Return the line number that contains the marker instance with the
	//! marker handle \a mhandle.
	int markerLine(int mhandle);

	//! Return the number of the next line to contain at least one marker
	//! from a 32 bit mask of markers.  \a linenr is the line number to
	//! start the search from.  \a mask is the mask of markers to search
	//! for.
	//!
	//! \sa markerFindPrevious()
	int markerFindNext(int linenr,unsigned mask);

	//! Return the number of the previous line to contain at least one
	//! marker from a 32 bit mask of markers.  \a linenr is the line number
	//! to start the search from.  \a mask is the mask of markers to search
	//! for.
	//!
	//! \sa markerFindNext()
	int markerFindPrevious(int linenr,unsigned mask);

	//! Returns the widget's paper (ie. background) colour.
	//!
	//! \sa setPaper()
	TQColor paper() const;

	//! Recolours the document between the \a start and \a end positions.
	//! \a start defaults to the start of the document and \a end defaults
	//! to the end of the document.
	virtual void recolor(int start = 0,int end = -1);

	//! Register an image \a pm with ID \a id.  Registered images can be
	//! displayed in auto-completion lists.
	//!
	//! \sa clearRegisteredImages(), QextScintillaAPIs
	void registerImage(int id,const TQPixmap *pm);

	//! Replace the current selection, set by a previous call to
	//! findFirst() or findNext(), with \a replaceStr.
	//!
	//! \sa findFirst(), findNext()
	virtual void replace(const TQString &replaceStr);

	//! Reset the fold margin colours to their defaults.
	//!
	//! \sa setFoldMarginColors()
	void resetFoldMarginColors();

	//! The fold margin may be drawn as a one pixel sized checkerboard
	//! pattern of two colours, \a fore and \a back.
	//!
	//! \sa resetFoldMarginColors()
	void setFoldMarginColors(const TQColor &fore,const TQColor &back);

	//! Sets the APIs used for auto-completion to \a apis.  If \a apis is 0
	//! then any existing APIs are removed.
	//!
	//! \sa autoCompleteFromAPIs(), setCallTipsAPIs()
	void setAutoCompletionAPIs(QextScintillaAPIs *apis = 0);

	//! A fill-up character is one that, when entered while an
	//! auto-completion list is being displayed, causes the currently
	//! selected item from the list to be added to the text followed by the
	//! fill-up character.  \a fillups is the set of fill-up characters.
	//! The default is that no fill-up characters are set, although a lexer may
    //! set its own.  Explicitly setting the fill-up characters using this
    //! method automatically enables their use.
    //!
    //! \sa autoCompletionFillupsEnabled(), setAutoCompletionFillupsEnabled()
	void setAutoCompletionFillups(const char *fillups);

    //! Enable the use of fill-up characters, either those explicitly set or
    //! those set by a lexer.  By default, fill-up characters are disabled.
    //!
    //! \sa autoCompletionFillupsEnabled(), setAutoCompletionFillups()
    void setAutoCompletionFillupsEnabled(bool enabled);

	//! A start character is one that, when entered, causes the
	//! auto-completion list to be displayed.  If a language lexer has been
	//! set then this is ignored and the lexer defines the start
	//! characters.  The default is that no start characters are set.
	//!
	//! \sa setAutoCompletionThreshold()
	void setAutoCompletionStartCharacters(const char *start);

	//! Sets the APIs used for call tips to \a apis.  If \a apis is 0 then
	//! then call tips are disabled.
	//!
	//! \sa setAutoCompletionAPIs()
	void setCallTipsAPIs(QextScintillaAPIs *apis = 0);

	//! Set the background colour of call tips to \a col.  The default is
	//! white.
	void setCallTipsBackgroundColor(const TQColor &col);

	//! Set the foreground colour of call tips to \a col.  The default is
	//! mid-gray.
	void setCallTipsForegroundColor(const TQColor &col);

	//! Set the highlighted colour of call tip text to \a col.  The default
	//! is dark blue.
	void setCallTipsHighlightColor(const TQColor &col);

	//! Set the maximum number of call tips that are displayed to \a nr.
	//! If the maximum number is 0 then all applicable call tips are
	//! displayed.  If the maximum number is -1 then one call tip will be
	//! displayed with up and down arrows that allow the use to scroll
	//! through the full list.  The default is -1.
	//!
	//! \sa callTipsVisible()
	void setCallTipsVisible(int nr);

	//! Attach the document \a document, replacing the currently attached
	//! document.
	//!
	//! \sa document()
	void setDocument(const QextScintillaDocument &document);

	//! Set the color of the marker used to show that a line has exceeded
	//! the length set by setEdgeColumn().
	//!
	//! \sa edgeColor(), \sa setEdgeColumn
	void setEdgeColor(const TQColor &col);

	//! Set the number of the column after which lines are considered to be
	//! long.
	//!
	//! \sa edgeColumn()
	void setEdgeColumn(int colnr);

	//! Set the edge mode which determines how long lines are marked.
	//!
	//! \sa edgeMode()
	void setEdgeMode(EdgeMode mode);

    //! Set the default font.  This has no effect if a language lexer has been
    //! set.
    virtual void setFont(const TQFont &f);

	//! Set the background colour, including the alpha component, of marker
	//! \a mnr to \a col.  If \a mnr is -1 then the colour of all markers
	//! is set.  The default is white.
	//!
	//! \sa setMarkerForegroundColor()
	void setMarkerBackgroundColor(const TQColor &col,int mnr = -1);

	//! Set the foreground colour of marker \a mnr to \a col.  If \a mnr is
	//! -1 then the colour of all markers is set.  The default is black.
	//!
	//! \sa setMarkerBackgroundColor()
	void setMarkerForegroundColor(const TQColor &col,int mnr = -1);

	//! Set the background colour used to display matched braces to \a col.
	//! The default is white.
	//!
	//! \sa setMatchedBraceForegroundColor()
	void setMatchedBraceBackgroundColor(const TQColor &col);

	//! Set the foreground colour used to display matched braces to \a col.
	//! The default is red.
	//!
	//! \sa setMatchedBraceBackgroundColor()
	void setMatchedBraceForegroundColor(const TQColor &col);

	//! Set the background colour used to display unmatched braces to
	//! \a col.  The default is white.
	//!
	//! \sa setUnmatchedBraceForegroundColor()
	void setUnmatchedBraceBackgroundColor(const TQColor &col);

	//! Set the foreground colour used to display unmatched braces to
	//! \a col.  The default is blue.
	//!
	//! \sa setUnmatchedBraceBackgroundColor()
	void setUnmatchedBraceForegroundColor(const TQColor &col);

	//! Set the visual flags displayed when a line is wrapped.  \a eflag
	//! determines if and where the flag at the end of a line is displayed.
	//! \a sflag determines if and where the flag at the start of a line is
	//! displayed.  \a sindent is the number of characters a wrapped line
	//! is indented by.  By default no visual flags are displayed.
	void setWrapVisualFlags(WrapVisualFlag eflag,
			WrapVisualFlag sflag = WrapFlagNone, int sindent = 0);

	//! Returns the selected text or an empty string if there is no
	//! currently selected text.
	//!
	//! \sa hasSelectedText()
	TQString selectedText();

	//! Displays a user defined list which can be interacted with like an
	//! auto-completion list.  \a id is an identifier for the list which
	//! is passed as an argument to the userListActivated() signal and must
	//! be at least 1.  \a list is the text with which the list is
	//! populated.
	//!
	//! \sa cancelList(), isListActive(), userListActivated()
	void showUserList(int id, const TQStringList &list);

	//! The standard command set is returned.
	QextScintillaCommandSet *standardCommands() const {return stdCmds;}

	//! Returns TRUE if the tab key indents a line instead of inserting a
	//! tab character.  The default is TRUE.
	//!
	//! \sa setTabIndents(), backspaceUnindents(), setBackspaceUnindents()
	bool tabIndents();

	//! Returns the tab width in characters.  The default is 8.
	//!
	//! \sa setTabWidth()
	int tabWidth();

	//! Returns the text edit's text.
	//!
	//! \sa setText()
	TQString text();

	//! \overload
	//!
	//! Returns the text of line \a line.
	//!
	//! \sa setText()
	TQString text(int line);

	//! Returns the height in pixels of the text in line number \a linenr.
	int textHeight(int linenr);

	//! Returns the visibility of whitespace.
	//!
	//! \sa setWhitespaceVisibility()
	WhitespaceVisibility whitespaceVisibility();

	//! Returns the line wrap mode.
	//!
	//! \sa setWrapMode()
	WrapMode wrapMode();

public slots:
	//! Appends the text \a text to the end of the text edit.  Note that
	//! the undo/redo history is cleared by this function.
	virtual void append(const TQString &text);

	//! Display an auto-completion list based on any installed APIs, the
	//! current contents of the document and the characters immediately to
	//! the left of the cursor.
	//!
	//! \sa autoCompleteFromAPIs(), autoCompleteFromDocument()
	virtual void autoCompleteFromAll();

	//! Display an auto-completion list based on any installed APIs and the
	//! characters immediately to the left of the cursor.
	//!
	//! \sa autoCompleteFromAll(), autoCompleteFromDocument(),
	//! setAutoCompletionAPIs()
	virtual void autoCompleteFromAPIs();

	//! Display an auto-completion list based on the current contents of
	//! the document and the characters immediately to the left of the
	//! cursor.
	//!
	//! \sa autoCompleteFromAll(), autoCompleteFromAPIs()
	virtual void autoCompleteFromDocument();

	//! Display a call tip based on the the characters immediately to the
	//! left of the cursor.
	virtual void callTip();

	//! Deletes all the text in the text edit.
	virtual void clear();

	//! Copies any selected text to the clipboard.
	//!
	//! \sa copyAvailable(), cut(), paste()
	virtual void copy();

	//! Copies any selected text to the clipboard and then deletes the
	//! text.
	//!
	//! \sa copy(), paste()
	virtual void cut();

	//! Ensures that the cursor is visible.
	virtual void ensureCursorVisible();

	//! Ensures that the line number \a line is visible.
	virtual void ensureLineVisible(int line);

	//! If any lines are currently folded then they are all unfolded.
	//! Otherwise all lines are folded.  This has the same effect as
	//! clicking in the fold margin with the shift and control keys
	//! pressed.  If \a children is not set (the default) then only the top
	//! level fold points are affected, otherwise the state of all fold
	//! points are changed.
	virtual void foldAll(bool children = FALSE);

	//! If the line \a line is folded then it is unfolded.  Otherwise it is
	//! folded.  This has the same effect as clicking in the fold margin.
	virtual void foldLine(int line);

	//! Increases the indentation of line \a line by an indentation width.
	//!
	//! \sa unindent()
	virtual void indent(int line);

	//! Insert the text \a text at the current position.
	virtual void insert(const TQString &text);

	//! Insert the text \a text in the line \a line at the position
	//! \a index.
	virtual void insertAt(const TQString &text,int line,int index);

	//! If the cursor is either side of a brace character then move it to
	//! the position of the corresponding brace.
	virtual void moveToMatchingBrace();

	//! Pastes any text from the clipboard into the text edit at the
	//! current cursor position.
	//!
	//! \sa copy(), cut()
	virtual void paste();

	//! Redo the last change or sequence of changes.
	//!
	//! \sa isRedoAvailable()
	virtual void redo();

	//! Removes any selected text.
	virtual void removeSelectedText();

	//! Resets the background colour of selected text to the default.
	//!
	//! \sa setSelectionBackgroundColor(), resetSelectionForegroundColor()
	virtual void resetSelectionBackgroundColor();

	//! Resets the foreground colour of selected text to the default.
	//!
	//! \sa setSelectionForegroundColor(), resetSelectionBackgroundColor()
	virtual void resetSelectionForegroundColor();

	//! If \a select is TRUE (the default) then all the text is selected.
	//! If \a select is FALSE then any currently selected text is
	//! deselected.
	virtual void selectAll(bool select = TRUE);

	//! If the cursor is either side of a brace character then move it to
	//! the position of the corresponding brace and select the text between
	//! the braces.
	virtual void selectToMatchingBrace();

	//! If \a cs is TRUE then auto-completion lists are case sensitive.
	//! The default is TRUE.
	//!
	//! \sa autoCompletionCaseSensitivity()
	virtual void setAutoCompletionCaseSensitivity(bool cs);

	//! If \a replace is TRUE then when an item from an auto-completion
	//! list is selected, the rest of the word to the right of the current
	//! cursor is removed.  The default is FALSE.
	//!
	//! \sa autoCompletionReplaceWord()
	virtual void setAutoCompletionReplaceWord(bool replace);

	//! If \a single is TRUE then when there is only a single entry in an
	//! auto-completion list it is automatically used and the list is not
	//! displayed.  This only has an effect when auto-completion is
	//! explicitly requested (using autoCompleteFromAPIs() and
	//! autoCompleteFromDocument()) and has no effect when auto-completion
	//! is triggered as the user types.  The default is FALSE.
	//!
	//! \sa autoCompletionShowSingle()
	virtual void setAutoCompletionShowSingle(bool single);

	//! Sets the source for the auto-completion list when it is being
	//! displayed automatically as the user types to \a source.  The
	//! default is AcsDocument.
	//!
	//! \sa autoCompletionSource()
	virtual void setAutoCompletionSource(AutoCompletionSource source);

	//! Sets the threshold for the automatic display of the auto-completion
	//! list as the user types to \a thresh.  The threshold is the number
	//! of characters that the user must type before the list is displayed.
	//! If the threshold is less than or equal to 0 then the list is
	//! disabled.  The default is -1.
	//!
	//! \sa autoCompletionThreshold(), setAutoCompletionStartCharacters()
	virtual void setAutoCompletionThreshold(int thresh);

	//! If \a autoindent is TRUE then auto-indentation is enabled.  The
	//! default is FALSE.
	//!
	//! \sa autoIndent()
	virtual void setAutoIndent(bool autoindent);

	//! Sets the brace matching mode to \a bm.  The default is
	//! NoBraceMatching.
	//!
	//! \sa braceMatching()
	virtual void setBraceMatching(BraceMatch bm);

	//! If \a deindent is TRUE then the backspace key will unindent a line
	//! rather then delete a character.
	//!
	//! \sa backspaceUnindents(), tabIndents(), setTabIndents()
	virtual void setBackspaceUnindents(bool unindent);

	//! Sets the foreground colour of the caret to \a col.
	virtual void setCaretForegroundColor(const TQColor &col);

	//! Sets the background colour, including the alpha component, of the
	//! line containing the caret to \a col.
	//!
	//! \sa setCaretLineVisible()
	virtual void setCaretLineBackgroundColor(const TQColor &col);

	//! Enables or disables, according to \a enable, the background color
	//! of the line containing the caret.
	//!
	//! \sa setCaretLineBackgroundColor()
	virtual void setCaretLineVisible(bool enable);

	//! Sets the width of the caret to \a width pixels.  A \a width of 0
	//! makes the caret invisible.
	virtual void setCaretWidth(int width);

	//! The widget's text (ie. foreground) colour is set to \a c.  This has no
    //! effect if a language lexer has been set.
	//!
	//! \sa color()
	virtual void setColor(const TQColor &c);

	//! Sets the cursor to the line \a line at the position \a index.
	//!
	//! \sa getCursorPosition()
	virtual void setCursorPosition(int line,int index);

	//! Sets the end-of-line mode to \a mode.  The default is the
	//! platform's natural mode.
	//!
	//! \sa eolMode()
	virtual void setEolMode(EolMode mode);

	//! If \a visible is TRUE then end-of-lines are made visible.  The
	//! default is that they are invisible.
	//!
	//! \sa eolVisibility()
	virtual void setEolVisibility(bool visible);

	//! Sets the folding style for margin 2 to \a fold.  The default is
	//! NoFoldStyle (ie. folding is disabled).
	//!
	//! \sa folding()
	virtual void setFolding(FoldStyle fold);

	//! Sets the indentation of line \a to \a indentation characters.
	//!
	//! \sa indentation()
	virtual void setIndentation(int line,int indentation);

	//! Enables or disables, according to \a enable, this display of
	//! indentation guides.
	//!
	//! \sa indentationGuides()
	virtual void setIndentationGuides(bool enable);

	//! Set the background colour of indentation guides to \a col.
	//!
	//! \sa setIndentationGuidesForegroundColor()
	virtual void setIndentationGuidesBackgroundColor(const TQColor &col);

	//! Set the foreground colour of indentation guides to \a col.
	//!
	//! \sa setIndentationGuidesBackgroundColor()
	virtual void setIndentationGuidesForegroundColor(const TQColor &col);

	//! If \a tabs is TRUE then indentations are created using tabs and
	//! spaces, rather than just spaces.
	//!
	//! \sa indentationsUseTabs()
	virtual void setIndentationsUseTabs(bool tabs);

	//! Sets the indentation width to \a width characters.  If \a width is
	//! 0 then the value returned by tabWidth() is used.
	//!
	//! \sa indentationWidth(), tabWidth()
	virtual void setIndentationWidth(int width);

	//! Sets the specific language lexer used to style text to \a lexer.  If
	//! \a lexer is 0 then syntax styling is disabled.
	//!
	//! \sa lexer()
	virtual void setLexer(QextScintillaLexer *lexer = 0);

	//! Set the background colour of all margins to \a col.  The default is
	//! a gray.
	//!
	//! \sa setMarginsForegroundColor()
	virtual void setMarginsBackgroundColor(const TQColor &col);

	//! Set the font used in all margins to \a f.
	virtual void setMarginsFont(const TQFont &f);

	//! Set the foreground colour of all margins to \a col.  The default is
	//! black.
	//!
	//! \sa setMarginsBackgroundColor()
	virtual void setMarginsForegroundColor(const TQColor &col);

	//! Enables or disables, according to \a lnrs, the display of line
	//! numbers in margin \a margin.
	//!
	//! \sa marginLineNumbers(), QextScintillaBase::SCI_SETMARGINTYPEN
	virtual void setMarginLineNumbers(int margin,bool lnrs);

	//! Sets the marker mask of margin \a margin to \a mask.  Only those
	//! markers whose bit is set in the mask are displayed in the margin.
	//!
	//! \sa marginMarkerMask(), QextScintillaMarker,
	//! QextScintillaBase::SCI_SETMARGINMASKN
	virtual void setMarginMarkerMask(int margin,int mask);

	//! Enables or disables, according to \a sens, the sensitivity of
	//! margin \a margin to mouse clicks.  If the user clicks in a
	//! sensitive margin the marginClicked() signal is emitted.
	//!
	//! \sa marginSensitivity(), marginClicked(),
	//! QextScintillaBase::SCI_SETMARGINSENSITIVEN
	virtual void setMarginSensitivity(int margin,bool sens);

	//! Sets the width of margin \a margin to \a width pixels.  If the
	//! width of a margin is 0 then it is not displayed.
	//!
	//! \sa marginWidth(), QextScintillaBase::SCI_SETMARGINWIDTHN
	virtual void setMarginWidth(int margin,int width);

	//! Sets the width of margin \a margin so that it is wide enough to
	//! display \a s in the current margin font.
	//!
	//! \sa marginWidth(), QextScintillaBase::SCI_SETMARGINWIDTHN
	virtual void setMarginWidth(int margin,const TQString &s);

	//! Sets the modified state of the text edit to \a m.  Note that it is
	//! only possible to clear the modified state (where \a m is FALSE).
	//! Attempts to set the modified state (where \a m is TRUE) are
	//! ignored.
	//!
	//! \sa isModified(), modificationChanged()
	virtual void setModified(bool m);

	//! The widget's paper (ie. background) colour is set to \a c.  This has no
    //! effect if a language lexer has been set.
	//!
	//! \sa paper()
	virtual void setPaper(const TQColor &c);

	//! Sets the read-only state of the text edit to \a ro.
	//!
	//! \sa isReadOnly()
	virtual void setReadOnly(bool ro);

	//! Sets the selection which starts at position \a indexFrom in line
	//! \a lineFrom and ends at position \a indexTo in line \a lineTo.  The
	//! cursor is moved to the end of the selection.
	//!
	//! \sa getSelection()
	virtual void setSelection(int lineFrom,int indexFrom,
				  int lineTo,int indexTo);

	//! Sets the background colour, including the alpha component, of
	//! selected text to \a col.
	//!
	//! \sa resetSelectionBackgroundColor(), setSelectionForegroundColor()
	virtual void setSelectionBackgroundColor(const TQColor &col);

	//! Sets the foreground colour of selected text to \a col.
	//!
	//! \sa resetSelectionForegroundColor(), setSelectionBackgroundColor()
	virtual void setSelectionForegroundColor(const TQColor &col);

	//! If \a indent is TRUE then the tab key will indent a line rather
	//! then insert a tab character.
	//!
	//! \sa tabIndents(), backspaceUnindents(), setBackspaceUnindents()
	virtual void setTabIndents(bool indent);

	//! Sets the tab width to \a width characters.
	//!
	//! \sa tabWidth()
	virtual void setTabWidth(int width);

	//! Replaces all of the current text with \a text.  Note that the
	//! undo/redo history is cleared by this function.
	//!
	//! \sa text()
	virtual void setText(const TQString &text);

	//! Sets the current text encoding.  If \a cp is TRUE then UTF8 is
	//! used, otherwise Latin1 is used.
	//!
	//! \sa isUtf8()
	virtual void setUtf8(bool cp);

	//! Sets the visibility of whitespace to mode \a mode.  The default is
	//! that whitespace is invisible.
	//!
	//! \sa whitespaceVisibility()
	virtual void setWhitespaceVisibility(WhitespaceVisibility mode);

	//! Sets the line wrap mode to mode \a mode.  The default is that lines
	//! are not wrapped.
	//!
	//! \sa wrapMode()
	virtual void setWrapMode(WrapMode mode);

	//! Undo the last change or sequence of changes.
	//!
	//! Scintilla has multiple level undo and redo.  It will continue to
	//! record undoable actions until memory runs out.  Sequences of
	//! typing or deleting are compressed into single actions to make it
	//! easier to undo and redo at a sensible level of detail.  Sequences
	//! of actions can be combined into actions that are undone as a unit.
	//! These sequences occur between calls to beginUndoAction() and
	//! endUndoAction().  These sequences can be nested and only the top
	//! level sequences are undone as units. 
	//!
	//! \sa beginUndoAction(), endUndoAction(), isUndoAvailable()
	virtual void undo();

	//! Decreases the indentation of line \a line by an indentation width.
	//!
	//! \sa indent()
	virtual void unindent(int line);

	//! Zooms in on the text by by making the base font size \a range
	//! points larger and recalculating all font sizes.
	//!
	//! \sa zoomOut(), zoomTo()
	virtual void zoomIn(int range);

	//! \overload
	//!
	//! Zooms in on the text by by making the base font size one point
	//! larger and recalculating all font sizes.
	virtual void zoomIn();

	//! Zooms out on the text by by making the base font size \a range
	//! points smaller and recalculating all font sizes.
	//!
	//! \sa zoomIn(), zoomTo()
	virtual void zoomOut(int range);

	//! \overload
	//!
	//! Zooms out on the text by by making the base font size one point
	//! larger and recalculating all font sizes.
	virtual void zoomOut();

	//! Zooms the text by making the base font size \a size points and
	//! recalculating all font sizes.
	//!
	//! \sa zoomIn(), zoomOut()
	virtual void zoomTo(int size);

signals:
	//! This signal is emitted whenever the cursor position changes.
	//! \a line contains the line number and \a pos contains the
	//! character position within the line.
	void cursorPositionChanged(int line,int pos);

	//! This signal is emitted whenever text is selected or de-selected.
	//! \a yes is TRUE if text has been selected and FALSE if text has been
	//! deselected.  If \a yes is TRUE then copy() can be used to copy the
	//! selection to the clipboard.  If \a yes is FALSE then copy() does
	//! nothing. 
	//!
	//! \sa copy(), selectionChanged()
	void copyAvailable(bool yes);

	//! This signal is emitted whenever the user clicks on a sensitive
	//! margin.  \a margin is the margin.  \a line is the number of the
	//! line where the user clicked.  \a state is the state of the modifier
	//! keys (ShiftButton, ControlButton and AltButton) when the user
	//! clicked.
	//!
	//! \sa marginSensitivity(), setMarginSensitivity()
	void marginClicked(int margin,int line,TQt::ButtonState state);

	//! This signal is emitted whenever the user attempts to modify
	//! read-only text.
	//!
	//! \sa isReadOnly(), setReadOnly()
	void modificationAttempted();

	//! This signal is emitted whenever the modification state of the text
	//! changes.  \a m is TRUE if the text has been modified.
	//!
	//! \sa isModified(), setModified()
	void modificationChanged(bool m);

	//! This signal is emitted whenever the selection changes.
	//!
	//! \sa copyAvailable()
	void selectionChanged();

	//! This signal is emitted whenever the text in the text edit changes.
	void textChanged();

	//! This signal is emitted when an item in a user defined list is
	//! activated (selected).  \a id is the list identifier.  \a string is
	//! the text of the item.
	//!
	//! \sa showUserList()
	void userListActivated(int id, const TQString &string);

private slots:
	void handleCallTipClick(int dir);
	void handleCharAdded(int charadded);
	void handleMarginClick(int pos,int margin,int modifiers);
	void handleModified(int pos,int mtype,const char *text,int len,
			    int added,int line,int foldNow,int foldPrev);
	void handlePropertyChange(const char *prop,const char *val);
	void handleSavePointReached();
	void handleSavePointLeft();
	void handleSelectionChanged(bool yes);
	void handleUserListSelection(const char *text, int id);

	void handleStyleColorChange(const TQColor &c,int style);
	void handleStyleEolFillChange(bool eolfill,int style);
	void handleStyleFontChange(const TQFont &f,int style);
	void handleStylePaperChange(const TQColor &c,int style);

	void handleUpdateUI();

private:
	enum IndentState {
		isNone,
		isKeywordStart,
		isBlockStart,
		isBlockEnd
	};

	void maintainIndentation(char ch,long pos);
	void autoIndentation(char ch,long pos);
	void autoIndentLine(long pos,int line,int indent);
	int blockIndent(int line);
	IndentState getIndentState(int line);
	bool rangeIsWhitespace(long spos,long epos);
	int findStyledWord(const char *text,int style,const char *words);

	void checkMarker(int &mnr);
	long posFromLineIndex(int line,int index);
	void lineIndexFromPos(long pos,int *line,int *index);
	int currentIndent();
	int indentWidth();
	bool doFind();
	long simpleFind();
	void foldClick(int lineClick,int bstate);
	void foldChanged(int line,int levelNow,int levelPrev);
	void foldExpand(int &line,bool doExpand,bool force = FALSE,
			int visLevels = 0,int level = -1);
	void setFoldMarker(int marknr,int mark = SC_MARK_EMPTY);
	TQString convertText(const char *s);
	void setStylesFont(const TQFont &f,int style);

	void braceMatch();
	bool findMatchingBrace(long &brace,long &other,BraceMatch mode);
	long checkBrace(long pos,int brace_style,bool &colonMode);
	void gotoMatchingBrace(bool select);

	void startAutoCompletion(AutoCompletionSource acs, bool checkThresh,
			bool single);
	bool isAutoCStartChar(char ch) const;

	bool currentCharInWord();
	bool isWordChar(char ch) const;

	bool ensureRW();

	struct FindState
	{
		FindState() : inProgress(0) {}

		bool inProgress;
		TQString expr;
		bool wrap;
		bool forward;
		int flags;
		long startpos;
		long endpos;
		bool show;
	};

	FindState findState;

	unsigned allocatedMarkers;
	long oldPos;
	bool selText;
	FoldStyle fold;
	bool autoInd;
	BraceMatch braceMode;
	AutoCompletionSource acSource;
	int acThresh;
	const char *acStart;
	QextScintillaAPIs *acAPIs;
	QextScintillaAPIs *ctAPIs;
	int maxCallTips;
	bool showSingle;
	long ctpos;
	TQGuardedPtr<QextScintillaLexer> lex;
	QextScintillaCommandSet *stdCmds;
	QextScintillaDocument doc;
	bool modified;
	TQColor nl_text_colour;
	TQColor nl_paper_colour;
	TQFont nl_font;
	bool explicit_fillups;
    bool fillups_enabled;
    TQCString saved_fillups;

#if defined(TQ_DISABLE_COPY)
	QextScintilla(const QextScintilla &);
	QextScintilla &operator=(const QextScintilla &);
#endif
};

#endif