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
|
// This is the SIP interface definition for TQTextEdit.
//
// Copyright (c) 2007
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
//
// This file is part of PyTQt.
//
// This copy of PyTQt 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.
//
// PyTQt 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
// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
%ExportedDoc
<Sect2><Title>TQTextEdit (TQt v3+)</Title>
<FuncSynopsis>
<FuncDef>int <Function>charAt</Function></FuncDef>
<ParamDef>const TQPoint &<Parameter>pos</Parameter></ParamDef>
<ParamDef>int *<Parameter>para</Parameter> = 0</ParamDef>
</FuncSynopsis>
<Para>
This takes only the <Literal>pos</Literal> parameter and returns a tuple of the
value returned via the <Literal>para</Literal> pointer and the int result.
</Para>
<FuncSynopsis>
<FuncDef>void <Function>del</Function></FuncDef>
<ParamDef></ParamDef>
</FuncSynopsis>
<Para>
This has been renamed <Literal>delChar</Literal> in Python.
</Para>
<FuncSynopsis>
<FuncDef>virtual bool <Function>find</Function></FuncDef>
<ParamDef>const TQString &<Parameter>expr</Parameter></ParamDef>
<ParamDef>bool <Parameter>cs</Parameter></ParamDef>
<ParamDef>bool <Parameter>wo</Parameter></ParamDef>
<ParamDef>bool <Parameter>forward</Parameter> = TRUE</ParamDef>
<ParamDef>int *<Parameter>para</Parameter> = 0</ParamDef>
<ParamDef>int *<Parameter>index</Parameter> = 0</ParamDef>
</FuncSynopsis>
<Para>
If the <Literal>para</Literal> and <Literal>index</Literal> parameters are
omitted then the bool result is returned. If both are supplied (as integers)
then a tuple of the bool result and the modified values of
<Literal>para</Literal> and <Literal>index</Literal> is returned.
</Para>
<FuncSynopsis>
<FuncDef>void <Function>getCursorPosition</Function></FuncDef>
<ParamDef>int *<Parameter>para</Parameter></ParamDef>
<ParamDef>int *<Parameter>index</Parameter></ParamDef>
</FuncSynopsis>
<Para>
This takes no parameters and returns a tuple of the values returned via the
<Literal>para</Literal> and <Literal>index</Literal> pointers.
</Para>
<FuncSynopsis>
<FuncDef>void <Function>getSelection</Function></FuncDef>
<ParamDef>int *<Parameter>paraFrom</Parameter></ParamDef>
<ParamDef>int *<Parameter>indexFrom</Parameter></ParamDef>
<ParamDef>int *<Parameter>paraTo</Parameter></ParamDef>
<ParamDef>int *<Parameter>indexTo</Parameter></ParamDef>
<ParamDef>int <Parameter>selNum</Parameter> = 0</ParamDef>
</FuncSynopsis>
<Para>
This takes only the <Literal>selNum</Literal> parameter and returns a tuple of
the <Literal>paraFrom</Literal>, <Literal>indexFrom</Literal>,
<Literal>paraTo</Literal> and <Literal>indexTo</Literal> values.
</Para>
</Sect2>
%End
%If (TQt_3_0_0 -)
// These aren't part of the public API in the TQt3 beta, so define them as
// opaque for the moment.
class TQTextDocument;
class TQTextCursor;
class TQTextEdit : TQScrollView
{
%TypeHeaderCode
#include <qtextedit.h>
%End
public:
enum WordWrap {
NoWrap,
WidgetWidth,
FixedPixelWidth,
FixedColumnWidth
};
enum WrapPolicy {
AtWordBoundary,
Anywhere,
AtWhiteSpace,
%If (TQt_3_1_0 -)
AtWordOrDocumentBoundary
%End
};
%If (TQt_3_1_0 -)
enum AutoFormatting {
AutoNone,
AutoBulletList,
AutoAll
};
%End
enum KeyboardAction {
ActionBackspace,
ActionDelete,
ActionReturn,
ActionKill,
%If (TQt_3_1_0 -)
ActionWordBackspace,
ActionWordDelete
%End
};
enum CursorAction {
MoveBackward,
MoveForward,
MoveWordBackward,
MoveWordForward,
MoveUp,
MoveDown,
MoveLineStart,
MoveLineEnd,
MoveHome,
MoveEnd,
MovePgUp,
MovePgDown
};
enum VerticalAlignment {
AlignNormal,
AlignSuperScript,
AlignSubScript
};
%If (TQt_3_1_0 -)
enum TextInsertionFlags {
RedoIndentation,
CheckNewLines,
RemoveSelected
};
%End
TQTextEdit(const TQString &,const TQString & = TQString::null,
TQWidget * /TransferThis/ = 0,const char * = 0);
TQTextEdit(TQWidget * /TransferThis/ = 0,const char * = 0);
void setPalette(const TQPalette &);
TQString text() const;
TQString text(int) const;
TextFormat textFormat() const;
TQString context() const;
TQString documentTitle() const;
void getSelection(int *,int *,int *,int *,int = 0) const;
// We implement find() as two separate methods as it's the easiest way
// to handle the somewhat strange TQt interface.
virtual bool find(const TQString &,bool,bool,bool = 1);
virtual bool find(const TQString &,bool,bool,bool,int * /In,Out/,
int * /In,Out/);
int paragraphs() const;
int lines() const;
int linesOfParagraph(int) const;
int lineOfChar(int,int);
int length() const;
TQRect paragraphRect(int) const;
int paragraphAt(const TQPoint &) const;
// Note that this is handwritten code because the generated code would
// return the values in the (correct but) reverse order.
SIP_PYTUPLE charAt(const TQPoint &) const;
%MethodCode
int para, index;
Py_BEGIN_ALLOW_THREADS
index = sipCpp -> TQTextEdit::charAt(*a0,¶);
Py_END_ALLOW_THREADS
sipRes = sipBuildResult(&sipIsErr,"(ii)",para,index);
%End
int paragraphLength(int) const;
TQStyleSheet *styleSheet() const;
TQMimeSourceFactory *mimeSourceFactory() const;
TQBrush paper() const;
bool linkUnderline() const;
int heightForWidth(int) const;
bool hasSelectedText() const;
TQString selectedText() const;
bool isUndoAvailable() const;
bool isRedoAvailable() const;
WordWrap wordWrap() const;
int wrapColumnOrWidth() const;
WrapPolicy wrapPolicy() const;
int tabStopWidth() const;
TQString anchorAt(const TQPoint &);
%If (TQt_3_1_0 -)
TQString anchorAt(const TQPoint &,AnchorAttribute);
%End
TQSize sizeHint() const;
bool isReadOnly() const;
void getCursorPosition(int *,int *) const;
bool isModified() const;
bool italic() const;
bool bold() const;
bool underline() const;
TQString family() const;
int pointSize() const;
TQColor color() const;
TQFont font() const;
%If (TQt_3_1_0 -)
TQFont currentFont() const;
%End
int alignment() const;
int undoDepth() const;
// These are undocumented and marked as "don't use".
//virtual bool getFormat(int,int,TQFont *,TQColor *,VerticalAlignment *);
//virtual bool getParagraphFormat(int,TQFont *,TQColor *,
// VerticalAlignment *,int *,
// TQStyleSheetItem::DisplayMode *,
// TQStyleSheetItem::ListStyle *,
// int *);
bool isOverwriteMode() const;
TQColor paragraphBackgroundColor(int) const;
bool isUndoRedoEnabled() const;
bool eventFilter(TQObject *,TQEvent *);
%If (TQt_3_1_0 -)
bool tabChangesFocus() const;
// TQt defines the following as uint rather than int because it uses the
// AutoFormatting enum as a set of flags. Because SIP implements enums
// as a subclass of int they are always signed. AutoAll is defined as
// 0xffffffff which Python converts to -1 and then fails to convert it
// to an unsigned. For the moment we just lie to SIP about the type
// and let the compiler handle it.
void setAutoFormatting(int);
int autoFormatting() const;
%End
%If (TQt_3_3_0 -)
TQSyntaxHighlighter *syntaxHighlighter() const;
%End
public slots:
void setEnabled(bool);
virtual void setMimeSourceFactory(TQMimeSourceFactory *);
virtual void setStyleSheet(TQStyleSheet *);
virtual void scrollToAnchor(const TQString &);
virtual void setPaper(const TQBrush &);
virtual void setLinkUnderline(bool);
virtual void setWordWrap(WordWrap);
virtual void setWrapColumnOrWidth(int);
virtual void setWrapPolicy(WrapPolicy);
virtual void copy();
virtual void append(const TQString &);
void setText(const TQString &);
virtual void setText(const TQString &,const TQString &);
virtual void setTextFormat(TextFormat);
virtual void selectAll(bool = 1);
virtual void setTabStopWidth(int);
virtual void zoomIn(int);
virtual void zoomIn();
virtual void zoomOut(int);
virtual void zoomOut();
virtual void zoomTo(int);
virtual void sync();
virtual void setReadOnly(bool);
virtual void undo();
virtual void redo();
virtual void cut();
virtual void paste();
virtual void pasteSubType(const TQCString &);
virtual void clear();
virtual void del() /PyName=delChar/;
virtual void indent();
virtual void setItalic(bool);
virtual void setBold(bool);
virtual void setUnderline(bool);
virtual void setFamily(const TQString &);
virtual void setPointSize(int);
virtual void setColor(const TQColor &);
virtual void setFont(const TQFont &);
virtual void setVerticalAlignment(VerticalAlignment);
virtual void setAlignment(int);
virtual void setParagType(TQStyleSheetItem::DisplayMode,
TQStyleSheetItem::ListStyle);
virtual void setCursorPosition(int,int);
virtual void setSelection(int,int,int,int,int = 0);
virtual void setSelectionAttributes(int,const TQColor &,bool);
virtual void setModified(bool);
virtual void resetFormat();
virtual void setUndoDepth(int);
// Marked as internal in the TQt3 beta.
// virtual void setFormat(TQTextFormat *,int);
virtual void ensureCursorVisible();
virtual void placeCursor(const TQPoint &,TQTextCursor * = 0);
virtual void moveCursor(CursorAction,bool);
virtual void doKeyboardAction(KeyboardAction);
virtual void removeSelectedText(int = 0);
virtual void removeSelection(int = 0);
virtual void setCurrentFont(const TQFont &);
virtual void setOverwriteMode(bool);
virtual void scrollToBottom();
%If (TQt_3_1_0 -)
void insert(const TQString &,uint = CheckNewLines | RemoveSelected);
virtual void insert(const TQString &,bool,bool = 1,bool = 1);
%End
%If (- TQt_3_1_0)
virtual void insert(const TQString &,bool = 0,bool = 1,bool = 1);
%End
virtual void insertAt(const TQString &,int,int);
virtual void removeParagraph(int);
virtual void insertParagraph(const TQString &,int);
virtual void setParagraphBackgroundColor(int,const TQColor &);
virtual void clearParagraphBackground(int);
virtual void setUndoRedoEnabled(bool);
%If (TQt_3_1_0 -)
void setTabChangesFocus(bool);
void polish();
%End
%If (TQt_3_2_0 -)
void setMaxLogLines(int);
int maxLogLines();
%End
signals:
void textChanged();
void selectionChanged();
void copyAvailable(bool);
void undoAvailable(bool);
void redoAvailable(bool);
void currentFontChanged(const TQFont &);
void currentColorChanged(const TQColor &);
void currentAlignmentChanged(int);
void currentVerticalAlignmentChanged(VerticalAlignment);
void cursorPositionChanged(TQTextCursor *);
void cursorPositionChanged(int,int);
void returnPressed();
void modificationChanged(bool);
%If (TQt_3_1_0 -)
void clicked(int,int);
void doubleClicked(int,int);
%End
protected:
void repaintChanged();
void updateStyles();
void drawContents(TQPainter *,int,int,int,int);
bool event(TQEvent *);
void keyPressEvent(TQKeyEvent *);
void resizeEvent(TQResizeEvent *);
void viewportResizeEvent(TQResizeEvent *);
void contentsMousePressEvent(TQMouseEvent *);
void contentsMouseMoveEvent(TQMouseEvent *);
void contentsMouseReleaseEvent(TQMouseEvent *);
void contentsMouseDoubleClickEvent(TQMouseEvent *);
void contentsWheelEvent(TQWheelEvent *);
void imStartEvent(TQIMEvent *);
void imComposeEvent(TQIMEvent *);
void imEndEvent(TQIMEvent *);
void contentsDragEnterEvent(TQDragEnterEvent *);
void contentsDragMoveEvent(TQDragMoveEvent *);
void contentsDragLeaveEvent(TQDragLeaveEvent *);
void contentsDropEvent(TQDropEvent *);
void contentsContextMenuEvent(TQContextMenuEvent *);
bool focusNextPrevChild(bool);
TQTextDocument *document() const;
TQTextCursor *textCursor() const;
void setDocument(TQTextDocument *);
virtual TQPopupMenu *createPopupMenu(const TQPoint &) /Factory/;
virtual TQPopupMenu *createPopupMenu() /Factory/;
void drawCursor(bool);
void windowActivationChange(bool);
protected slots:
virtual void doChangeInterval();
%If (TQt_3_1_0 -)
void sliderReleased();
%End
private:
%If (TQt_3_1_0 -)
TQTextEdit(const TQTextEdit &);
%End
};
%End
|