📄 khtmlview.h
字号:
bool dispatchKeyEvent( QKeyEvent *_ke ); bool dispatchKeyEventHelper( QKeyEvent *_ke, bool generate_keypress ); void complete( bool pendingAction );#ifndef KHTML_NO_TYPE_AHEAD_FIND void findAhead(bool increase); void updateFindAheadTimeout(); void startFindAhead( bool linksOnly );#endif // KHTML_NO_TYPE_AHEAD_FIND#ifndef KHTML_NO_CARET // -- caret-related member functions (for caretMode as well as designMode) /** initializes the caret if it hasn't been initialized yet. * * This method determines a suitable starting position, initializes * the internal structures, and calculates the caret's coordinates ready * for display. * * To "deinitialize" the caret, call caretOff * @param keepSelection @p true to keep any active selection. It may have * been extended if the caret position is changed. */ void initCaret(bool keepSelection = false); /** returns whether the text under the caret will be overridden. */ bool caretOverrides() const; /** ensures that the given element is properly focused. * * If not in caret mode or design mode, keyboard events are only regarded for * focused nodes. Therefore, the function ensured that the focus will be * properly set on unfocused nodes (or on a suitable ancestor). * @param node node to focus */ void ensureNodeHasFocus(DOM::NodeImpl *node); /** inquires the current caret position and stores it in the caret view * context. Also resets the blink frequency timer. It will not display * the caret on the canvas. * @param hintBox caret box whose coordinates will be used if the * caret position could not be determined otherwise. */ void recalcAndStoreCaretPos(khtml::CaretBox *hintBox = 0); /** displays the caret and reinitializes the blink frequency timer. * * The caret will only be displayed on screen if the view has focus, or * the caret display policy allows it. The same holds true for the blink * frequency timer. */ void caretOn(); /** hides the caret and kills the blink frequency timer. * * These operations are executed unconditionally, regardless of the * focus, and the caret display policy. */ void caretOff(); /** makes the caret visible, but does not influence the frequency timer. * That means it probably won't get visible immediately. * * These operations are executed unconditionally, regardless of the * focus, and the caret display policy. * @param forceRepaint @p true to force an immediate repaint, otherwise * do a scheduled repaint */ void showCaret(bool forceRepaint = false); /** makes the caret invisible, but does not influence the frequency timer. * The caret is immediately hidden. * * These operations are executed unconditionally, regardless of the * focus, and the caret display policy. */ void hideCaret(); /** shifts the viewport to ensure that the caret is visible. * * Note: this will also work if the caret is hidden. */ void ensureCaretVisible(); /** folds the selection to the current caret position. * * Whatever selection has existed before will be removed by the invocation * of this method. Updates are only done if an actual selection has * been folded. After the call of this method, no selection will exist * any more. * * No validity checking is done on the parameters. Note that the parameters * refer to the old selection, the current caret may be way off. * @param startNode starting node of selection * @param startOffset offset within the start node. * @param endNode ending node of selection * @param endOffset offset within the end node. * @return @p true if there had been a selection, and it was folded. */ bool foldSelectionToCaret(DOM::NodeImpl *startNode, long startOffset, DOM::NodeImpl *endNode, long endOffset); /** places the caret on the current position. * * The caret is switched off, the position recalculated with respect to * the new position. The caret will only be redisplayed if it is on an * editable node, in design mode, or in caret mode. * @param hintBox caret box whose coordinates will be used if the * caret position could not be determined otherwise. * @return @p true if the caret has been displayed. */ bool placeCaret(khtml::CaretBox *hintBox = 0); /** extends the selection up to the current caret position. * * When a selection exists, the function adds/removes pieces from the * beginning/end of the selection up to the current caret position. * * The selection values are *not* normalized, i. e. the resulting end * position may actually precede the starting position. * * No validity checking is done on the parameters. Note that the parameters * refer to the old selection, the current caret may be way off. * @param startNode starting node of selection * @param startOffset offset within the start node. * @param endNode ending node of selection * @param endOffset offset within the end node. * @return @p true when the current selection has been changed */ bool extendSelection(DOM::NodeImpl *startNode, long startOffset, DOM::NodeImpl *endNode, long endOffset); /** updates the selection from the last to the current caret position. * * No validity checking is done on the parameters. Note that the parameters * refer to the old selection, the current caret may be way off. * @param startNode starting node of selection * @param startOffset offset within the start node. * @param endNode ending node of selection * @param endOffset offset within the end node. */ void updateSelection(DOM::NodeImpl *startNode, long startOffset, DOM::NodeImpl *endNode, long endOffset); /** * Returns the current caret policy when the view is not focused. * @return a KHTMLPart::CaretDisplay value */ int caretDisplayPolicyNonFocused() const; /** * Sets the caret display policy when the view is not focused. * @param policy new display policy as * defined by KHTMLPart::CaretDisplayPolicy * @since 3.2 */ void setCaretDisplayPolicyNonFocused(int policy); // -- caret event handler /** * Evaluates key presses on editable nodes. */ void caretKeyPressEvent(QKeyEvent *); // -- caret navigation member functions /** moves the caret to the given position and displays it. * * If the node resembles an invalid position, the function sets the caret to a * nearby node that is valid. * * @param node node to be set to * @param offset zero-based offset within this node * @param clearSelection @p true if any selection should be cleared * as well. * @return @p true if a previously existing selection has been changed. */ bool moveCaretTo(DOM::NodeImpl *node, long offset, bool clearSelection); /** * Movement enumeration * @li CaretByCharacter move caret character-wise * @li CaretByWord move caret word-wise */ enum CaretMovement { CaretByCharacter, CaretByWord }; /** moves the caret. * * @param next @p true, move towards the following content, @p false, * move towards the previous * @param cmv CaretMovement operation * @param n count the CaretMovement has to be carried out. * For latin documents, a positive number means moving the caret * these many characters to the right/downwards, a negative number * to the left/upwards. For RTL documents, the opposite applies. */ void moveCaretBy(bool next, CaretMovement cmv, int n); /** moves the caret by line. */ void moveCaretByLine(bool next, int n); /** moves the caret to the given line boundary. * @param end @p true if the caret is to be moved to the end of the line, * otherwise to the beginning. */ void moveCaretToLineBoundary(bool end); /** moves the caret to the given document boundary. * @param end @p true if the caret is to be moved to the end of the * document, otherwise to the beginning. */ void moveCaretToDocumentBoundary(bool end); /** does the actual caret placement so that it becomes visible at * the new position. * * This method is only suitable if the new caret position has already been * determined. * @param hintBox caret box whose coordinates will be used if the * caret position could not be determined otherwise. */ void placeCaretOnChar(khtml::CaretBox *hintBox); /** does the actual caret placement so that it becomes visible at * the new position. * * Additionally, it calculates the new caret position from the given * box and coordinates. * * @param caretBox caret box serving as a measurement point for offset. * @param x x-coordinate relative to containing block. The offset will * be approximated as closely as possible to this coordinate, * but never less than caretBox->xPos() and greater than * caretBox->xPos() + caretBox->width() * @param absx absolute x-coordinate of containing block, needed for * calculation of final caret position * @param absy absolute y-coordinate of containing block, needed for * calculation of final caret position */ void placeCaretOnLine(khtml::CaretBox *caretBox, int x, int absx, int absy); /** moves the caret by a page length. * @param next @p true, move down, @p false, move up. */ void moveCaretByPage(bool next); /** moves the caret to the beginning of the previous word. */ void moveCaretPrevWord(); /** moves the caret to the beginning of the next word. */ void moveCaretNextWord(); /** moves the caret to the previous line. * * @param n number of lines to move caret */ void moveCaretPrevLine(int n = 1); /** moves the caret to the following line. * * @param n number of lines to move caret */ void moveCaretNextLine(int n = 1); /** moves the caret to the previous page */ void moveCaretPrevPage(); /** moves the caret to the next page */ void moveCaretNextPage(); /** moves the caret to the beginning of the current line. */ void moveCaretToLineBegin(); /** moves the caret to the end of the current line. */ void moveCaretToLineEnd();#endif // KHTML_NO_CARET // ------------------------------------- member variables ------------------------------------ private: void setWidgetVisible(::khtml::RenderWidget*, bool visible); int _width; int _height; int _marginWidth; int _marginHeight; KHTMLPart *m_part; KHTMLViewPrivate *d; QString m_medium; // media type};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -