You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
438 lines
12 KiB
438 lines
12 KiB
13 years ago
|
// This is the SIP interface definition for QTextEdit.
|
||
|
//
|
||
|
// Copyright (c) 2007
|
||
|
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
|
||
|
//
|
||
|
// This file is part of PyQt.
|
||
|
//
|
||
|
// This copy of PyQt 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.
|
||
|
//
|
||
|
// PyQt 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
|
||
|
// PyQt; 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>QTextEdit (Qt v3+)</Title>
|
||
|
<FuncSynopsis>
|
||
|
<FuncDef>int <Function>charAt</Function></FuncDef>
|
||
|
<ParamDef>const QPoint &<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 QString &<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 (Qt_3_0_0 -)
|
||
|
|
||
|
// These aren't part of the public API in the Qt3 beta, so define them as
|
||
|
// opaque for the moment.
|
||
|
|
||
|
class QTextDocument;
|
||
|
class QTextCursor;
|
||
|
|
||
|
|
||
|
class QTextEdit : QScrollView
|
||
|
{
|
||
|
%TypeHeaderCode
|
||
|
#include <qtextedit.h>
|
||
|
%End
|
||
|
|
||
|
public:
|
||
|
enum WordWrap {
|
||
|
NoWrap,
|
||
|
WidgetWidth,
|
||
|
FixedPixelWidth,
|
||
|
FixedColumnWidth
|
||
|
};
|
||
|
|
||
|
enum WrapPolicy {
|
||
|
AtWordBoundary,
|
||
|
Anywhere,
|
||
|
AtWhiteSpace,
|
||
|
%If (Qt_3_1_0 -)
|
||
|
AtWordOrDocumentBoundary
|
||
|
%End
|
||
|
};
|
||
|
|
||
|
%If (Qt_3_1_0 -)
|
||
|
enum AutoFormatting {
|
||
|
AutoNone,
|
||
|
AutoBulletList,
|
||
|
AutoAll
|
||
|
};
|
||
|
%End
|
||
|
|
||
|
enum KeyboardAction {
|
||
|
ActionBackspace,
|
||
|
ActionDelete,
|
||
|
ActionReturn,
|
||
|
ActionKill,
|
||
|
%If (Qt_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 (Qt_3_1_0 -)
|
||
|
enum TextInsertionFlags {
|
||
|
RedoIndentation,
|
||
|
CheckNewLines,
|
||
|
RemoveSelected
|
||
|
};
|
||
|
%End
|
||
|
|
||
|
QTextEdit(const QString &,const QString & = QString::null,
|
||
|
QWidget * /TransferThis/ = 0,const char * = 0);
|
||
|
QTextEdit(QWidget * /TransferThis/ = 0,const char * = 0);
|
||
|
|
||
|
void setPalette(const QPalette &);
|
||
|
|
||
|
QString text() const;
|
||
|
QString text(int) const;
|
||
|
TextFormat textFormat() const;
|
||
|
QString context() const;
|
||
|
QString 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 Qt interface.
|
||
|
virtual bool find(const QString &,bool,bool,bool = 1);
|
||
|
virtual bool find(const QString &,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;
|
||
|
QRect paragraphRect(int) const;
|
||
|
int paragraphAt(const QPoint &) 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 QPoint &) const;
|
||
|
%MethodCode
|
||
|
int para, index;
|
||
|
|
||
|
Py_BEGIN_ALLOW_THREADS
|
||
|
index = sipCpp -> QTextEdit::charAt(*a0,¶);
|
||
|
Py_END_ALLOW_THREADS
|
||
|
|
||
|
sipRes = sipBuildResult(&sipIsErr,"(ii)",para,index);
|
||
|
%End
|
||
|
|
||
|
int paragraphLength(int) const;
|
||
|
|
||
|
QStyleSheet *styleSheet() const;
|
||
|
QMimeSourceFactory *mimeSourceFactory() const;
|
||
|
|
||
|
QBrush paper() const;
|
||
|
bool linkUnderline() const;
|
||
|
|
||
|
int heightForWidth(int) const;
|
||
|
|
||
|
bool hasSelectedText() const;
|
||
|
QString selectedText() const;
|
||
|
bool isUndoAvailable() const;
|
||
|
bool isRedoAvailable() const;
|
||
|
|
||
|
WordWrap wordWrap() const;
|
||
|
int wrapColumnOrWidth() const;
|
||
|
WrapPolicy wrapPolicy() const;
|
||
|
|
||
|
int tabStopWidth() const;
|
||
|
|
||
|
QString anchorAt(const QPoint &);
|
||
|
%If (Qt_3_1_0 -)
|
||
|
QString anchorAt(const QPoint &,AnchorAttribute);
|
||
|
%End
|
||
|
|
||
|
QSize sizeHint() const;
|
||
|
|
||
|
bool isReadOnly() const;
|
||
|
|
||
|
void getCursorPosition(int *,int *) const;
|
||
|
|
||
|
bool isModified() const;
|
||
|
bool italic() const;
|
||
|
bool bold() const;
|
||
|
bool underline() const;
|
||
|
QString family() const;
|
||
|
int pointSize() const;
|
||
|
QColor color() const;
|
||
|
QFont font() const;
|
||
|
%If (Qt_3_1_0 -)
|
||
|
QFont currentFont() const;
|
||
|
%End
|
||
|
int alignment() const;
|
||
|
int undoDepth() const;
|
||
|
|
||
|
// These are undocumented and marked as "don't use".
|
||
|
//virtual bool getFormat(int,int,QFont *,QColor *,VerticalAlignment *);
|
||
|
//virtual bool getParagraphFormat(int,QFont *,QColor *,
|
||
|
// VerticalAlignment *,int *,
|
||
|
// QStyleSheetItem::DisplayMode *,
|
||
|
// QStyleSheetItem::ListStyle *,
|
||
|
// int *);
|
||
|
|
||
|
bool isOverwriteMode() const;
|
||
|
QColor paragraphBackgroundColor(int) const;
|
||
|
|
||
|
bool isUndoRedoEnabled() const;
|
||
|
bool eventFilter(QObject *,QEvent *);
|
||
|
%If (Qt_3_1_0 -)
|
||
|
bool tabChangesFocus() const;
|
||
|
|
||
|
// Qt 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 (Qt_3_3_0 -)
|
||
|
QSyntaxHighlighter *syntaxHighlighter() const;
|
||
|
%End
|
||
|
|
||
|
public slots:
|
||
|
void setEnabled(bool);
|
||
|
virtual void setMimeSourceFactory(QMimeSourceFactory *);
|
||
|
virtual void setStyleSheet(QStyleSheet *);
|
||
|
virtual void scrollToAnchor(const QString &);
|
||
|
virtual void setPaper(const QBrush &);
|
||
|
virtual void setLinkUnderline(bool);
|
||
|
|
||
|
virtual void setWordWrap(WordWrap);
|
||
|
virtual void setWrapColumnOrWidth(int);
|
||
|
virtual void setWrapPolicy(WrapPolicy);
|
||
|
|
||
|
virtual void copy();
|
||
|
virtual void append(const QString &);
|
||
|
|
||
|
void setText(const QString &);
|
||
|
virtual void setText(const QString &,const QString &);
|
||
|
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 QCString &);
|
||
|
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 QString &);
|
||
|
virtual void setPointSize(int);
|
||
|
virtual void setColor(const QColor &);
|
||
|
virtual void setFont(const QFont &);
|
||
|
virtual void setVerticalAlignment(VerticalAlignment);
|
||
|
virtual void setAlignment(int);
|
||
|
virtual void setParagType(QStyleSheetItem::DisplayMode,
|
||
|
QStyleSheetItem::ListStyle);
|
||
|
virtual void setCursorPosition(int,int);
|
||
|
virtual void setSelection(int,int,int,int,int = 0);
|
||
|
virtual void setSelectionAttributes(int,const QColor &,bool);
|
||
|
virtual void setModified(bool);
|
||
|
virtual void resetFormat();
|
||
|
virtual void setUndoDepth(int);
|
||
|
// Marked as internal in the Qt3 beta.
|
||
|
// virtual void setFormat(QTextFormat *,int);
|
||
|
virtual void ensureCursorVisible();
|
||
|
virtual void placeCursor(const QPoint &,QTextCursor * = 0);
|
||
|
virtual void moveCursor(CursorAction,bool);
|
||
|
virtual void doKeyboardAction(KeyboardAction);
|
||
|
virtual void removeSelectedText(int = 0);
|
||
|
virtual void removeSelection(int = 0);
|
||
|
virtual void setCurrentFont(const QFont &);
|
||
|
virtual void setOverwriteMode(bool);
|
||
|
|
||
|
virtual void scrollToBottom();
|
||
|
|
||
|
%If (Qt_3_1_0 -)
|
||
|
void insert(const QString &,uint = CheckNewLines | RemoveSelected);
|
||
|
virtual void insert(const QString &,bool,bool = 1,bool = 1);
|
||
|
%End
|
||
|
%If (- Qt_3_1_0)
|
||
|
virtual void insert(const QString &,bool = 0,bool = 1,bool = 1);
|
||
|
%End
|
||
|
virtual void insertAt(const QString &,int,int);
|
||
|
virtual void removeParagraph(int);
|
||
|
virtual void insertParagraph(const QString &,int);
|
||
|
|
||
|
virtual void setParagraphBackgroundColor(int,const QColor &);
|
||
|
virtual void clearParagraphBackground(int);
|
||
|
|
||
|
virtual void setUndoRedoEnabled(bool);
|
||
|
%If (Qt_3_1_0 -)
|
||
|
void setTabChangesFocus(bool);
|
||
|
|
||
|
void polish();
|
||
|
%End
|
||
|
%If (Qt_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 QFont &);
|
||
|
void currentColorChanged(const QColor &);
|
||
|
void currentAlignmentChanged(int);
|
||
|
void currentVerticalAlignmentChanged(VerticalAlignment);
|
||
|
void cursorPositionChanged(QTextCursor *);
|
||
|
void cursorPositionChanged(int,int);
|
||
|
void returnPressed();
|
||
|
void modificationChanged(bool);
|
||
|
%If (Qt_3_1_0 -)
|
||
|
void clicked(int,int);
|
||
|
void doubleClicked(int,int);
|
||
|
%End
|
||
|
|
||
|
protected:
|
||
|
void repaintChanged();
|
||
|
void updateStyles();
|
||
|
void drawContents(QPainter *,int,int,int,int);
|
||
|
bool event(QEvent *);
|
||
|
void keyPressEvent(QKeyEvent *);
|
||
|
void resizeEvent(QResizeEvent *);
|
||
|
void viewportResizeEvent(QResizeEvent *);
|
||
|
void contentsMousePressEvent(QMouseEvent *);
|
||
|
void contentsMouseMoveEvent(QMouseEvent *);
|
||
|
void contentsMouseReleaseEvent(QMouseEvent *);
|
||
|
void contentsMouseDoubleClickEvent(QMouseEvent *);
|
||
|
void contentsWheelEvent(QWheelEvent *);
|
||
|
void imStartEvent(QIMEvent *);
|
||
|
void imComposeEvent(QIMEvent *);
|
||
|
void imEndEvent(QIMEvent *);
|
||
|
void contentsDragEnterEvent(QDragEnterEvent *);
|
||
|
void contentsDragMoveEvent(QDragMoveEvent *);
|
||
|
void contentsDragLeaveEvent(QDragLeaveEvent *);
|
||
|
void contentsDropEvent(QDropEvent *);
|
||
|
void contentsContextMenuEvent(QContextMenuEvent *);
|
||
|
bool focusNextPrevChild(bool);
|
||
|
QTextDocument *document() const;
|
||
|
QTextCursor *textCursor() const;
|
||
|
void setDocument(QTextDocument *);
|
||
|
virtual QPopupMenu *createPopupMenu(const QPoint &) /Factory/;
|
||
|
virtual QPopupMenu *createPopupMenu() /Factory/;
|
||
|
void drawCursor(bool);
|
||
|
|
||
|
void windowActivationChange(bool);
|
||
|
|
||
|
protected slots:
|
||
|
virtual void doChangeInterval();
|
||
|
%If (Qt_3_1_0 -)
|
||
|
void sliderReleased();
|
||
|
%End
|
||
|
|
||
|
private:
|
||
|
%If (Qt_3_1_0 -)
|
||
|
QTextEdit(const QTextEdit &);
|
||
|
%End
|
||
|
};
|
||
|
|
||
|
%End
|