📄 htmlview.h
字号:
/** * Gets a list of all selected URLs. The list may be Null. * You can test this using list.isNull(). */ virtual void getSelected( QStrList &_list ); /** * Get the text the user has marked. * * @param _str is the QString which will contain the text the user * selected. The selected text is appended to any text currently in * _str. */ virtual void getSelectedText( QString &_str ); /** * Has the user selected any text? Call @ref #getSelectedText to * retrieve the selected text. * * @return true if there is text selected. */ bool isTextSelected() const; /** * Initiate a text search. */ void findTextBegin(); /** * Find the next occurrance of the expression. */ bool findTextNext( const QRegExp &exp ); /** * end a text search. */ void findTextEnd(); /** * This function allows you to customize the behavior of the * @ref KHTMLWidget. * * @return TRUE if the function handled the event, FALSE otherwise. * * @see #mousePressedHook * @see #mouseReleaseHook */ virtual bool mouseMoveHook( QMouseEvent *_ev ); /** * This function allows you to customize the behavior of the * @ref KHTMLWidget. * * @return TRUE if the function handled the event, FALSE otherwise. * * @see #mousePressedHook * @see #mouseMoveHook */ virtual bool mouseReleaseHook( QMouseEvent *_ev ); /** * This function is called if the user presses the mouse. If he clicks on * a link you get the URL in '_url'. * * @param _url is the clicked URL or 0L is there was none. * @param _target is the target frame if one is mentioned otherwise 0L. * @param _ev the @ref QMouseEvent. The coordinates of the mouse contained * in this event are relational to the upper left corner of the * @ref KHTMLWidget, not to this widget! * @param _isselected is TRUE of the URL '_url' is already selected. * * @return TRUE if the function handled the event, FALSE otherwise. * * @see #mouseMoveHook * @see #mouseReleaseHook */ virtual bool mousePressedHook( const char* _url, const char *_target, QMouseEvent *_ev, bool _isselected ); /** * This function is called if the user wants to start a DND action. * Overload this function and return TRUE to indicate that you processed * the event. By default the function returns FALSE. This causes the * @ref KHTMLWidget to process the event. * Usually this function calls @ref KHTMLWidget::startDrag like this: * <TT>view->startDrag(....)</TT>. Dont call the startDrag function of any * other window. KDND would not like it :-) * * @param _url is the URL the user wants to drag around. * @param _p is the mouse position in global coordinates. */ virtual bool dndHook( const char *_url, QPoint &_p ); /** * Selects all objects in this rectangle and deselects all objects * outside the rectangle. * * @param _rect is a rectangle in display coordinates. This means * that the point (0,0) is the upper/left most point of * the widget but must not be this one for the HTML page. * This happens if the widget is being scrolled. * @param _painter is a @ref QPainter or 0L. If it is 0L a new painter is * created. */ virtual void select( QPainter * _painter, QRect &_rect ); /** * Selects or deselects all objects. * * @param _painter is a @ref QPainter or 0L. If it is 0L a new painter is * created. */ virtual void select( QPainter * _painter, bool _select ); /** * Selects all objects which refer to '_url'. All selected objects * are redrawn if they changed their selection mode. * * @param _painter may be 0L. In this case a new @ref QPainter is created * and destroyed afterwards if no painter already exists. */ void selectByURL( QPainter * _painter, const char *_url, bool _select ); /** * @return a pointer to the low-level KHTMLWidget. You may use this * to set default colours, etc. supported by the widget. * * @see #view */ KHTMLWidget* getKHTMLWidget() { return view; } /** * @return the parent KHTMLView of this one or 0L is this is the top level * view. * * @see #parentView */ KHTMLView* getParentView() { return parentView; } /** * Never returns 0L. */ KHTMLView* topView(); /** * Called when a URL is encountered. Overload this method to indicate * which links have been visited previously. * * @return true if the URL has been visited previously. If true is * returned the URL will be rendered in the vlink color. If false * is returned the URL will be rendered in the link color. */ virtual bool URLVisited( const char * /*_url*/ ) { return false; } /** * * Sets charset for the View */ void setCharset( const char *_c); /** * set a charset, which will override the <meta ...> setting */ void setOverrideCharset(const char *name = 0); /** * For internal use only. * * @see #cookie */ const char* getCookie() { return cookie.data(); } /** * For internal use only. * * @see #cookie */ void setCookie( const char *_c ) { printf("Setting cookie '%s'\n",_c); cookie = _c; } void cancelAllRequests(); // Another option to feed image data into the HTML Widget void data( const char *_url, const char *_data, int _len, bool _eof ); /** tell the widget to save himself. Returns a struct, that can be used * to restore it's contents * @see restore() */ SavedPage *saveYourself(); /** * restores the contents of the widget to the state gotten by a call * to @ref saveYourself() */ void restore(SavedPage *); void restorePosition( int x, int y);signals: /** * This signal is emitted if we deal with frames ( or one of the child * widgets! ). * It tells the owner of the widget to provide a certain URL for a widget. * The owner has to call <PRE> * _widget->begin( .. ); * _widget->parse(); * _widget->write( .. ); .... * _widget->end(); * </PRE> * This may happen before returning ( directly after receiving this * signal ), or some time later on. You may be notified that the URL * is no longer wanted. This is done with the * signal @ref #cancelDocumentRequest. * * @param _widget is the widget that requests the document. * @param _url is the URL where the document can be found. * * @see #cancelDocumentRequest * @see #slotDocumentRequest */ void documentRequest( KHTMLView* _widget, const char* _url ); /** * This signal is emitted if the widget does not need the document any more. * * @param _url is the URL of the document that we dont need any more. */ void cancelDocumentRequest( KHTMLView *_view, const char *_url ); /** * This signal is emitted whenever the widget wants to * change the windows title. Usually this is the text * enclosed in the title tag. * * @param _title is a string of ASCII characters. */ void setTitle( const char *_title ); /** * Signals that the URL '_url' has been selected. The user used * the mouse button '_button' for this. * * @param _url is a full qualified URL. * @param _button is <tt>LeftButton, MiddleButton or RightButton</tt> * @param _target is the target window or 0L if none is specified. */ void URLSelected( KHTMLView *_view, const char *_url, int _button, const char *_target ); /** * Signals that the mouse cursor is over URL '_url'. * If '_url' is null then cursor moved off a URL * * @param _url is a full qualified URL. */ void onURL( KHTMLView *_view, const char *_url ); /** * Signal that the user has selected text or the existing selection has * become unselected. The text may be retrieved using * @ref #getSelectedText. This is a good signal to connect to for * enabling/disabling the Copy menu item or calling XSetSelectionOwner(). * * @param _selected is true if the user has selected text or false if * the current selection has been removed. */ void textSelected( KHTMLView *_view, bool _selected ); /** * This signal is Emitted if the user pressed the right mouse button * over an URL. '_url' may be 0L to indicate the the user pressed * the right mouse button over an area that does not have an anchor * tag. * * @param _url is a full qualified URL or 0L. * @param _point is the position where the user pressed the mouse button. * This point is already in global cooredinates. */ void popupMenu( KHTMLView *_view, const char *_url, const QPoint &_point ); /** * This signal is emitted if the widget requests to load an image. * KHTMLWidget can only load image from your local disk. If it * finds an image with another protocol in its URL, it will emit this * signal. If the image is loaded at some time, call @ref #slotImageLoaded. * If the image is not needed any more, the signal @ref #cancelImageRequest * is emitted. It may happen that not the widget itself but one of its * children requests the image. To distibuish that you get '_view'. * * @see #cancelImageRequest */ void imageRequest( KHTMLView *_view, const char *_url ); /** * This signal is only emitted if this widget and not one of its children * requests an image. */ void imageRequest( const char *_url ); /** * Cancels an image that has been requested before. * * @see #imageRequest */ void cancelImageRequest( KHTMLView *_view, const char *_url ); /** * This signal is only emitted if this widget and not one of its children * cancels a requested image. */ void cancelImageRequest( const char *_url ); /** * The user pressed a forms submit button. * * @param _url is the <form action=...> value * @param _method is the <form method=...> value * @param _data is the encoded data to send */ void formSubmitted( KHTMLView *_view, const char *_method, const char *_url, const char *_data ); /** * Emitted if the user presses the mouse button over this widget and if * the widget is a frame. In this case this frame became the selected one * and this signal is used to tell our parent about this. * * @see #setSeleced */ void frameSelected( KHTMLView *_view ); /** * The widget started working. You may use this signal to implement an * animated logo like netscape has one. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -