📄 html.h
字号:
*/ void cancelRequestFile( HTMLObject *_obj ); /* * Cancels all @ref requestFile. */ void cancelAllRequests(); // This function is called to download the background image from the web void requestBackgroundImage( const char *_url ); /* * This function is used to repaint images that have been loaded from the * web. */ void paintSingleObject( HTMLObject *_obj ); /* * Internal function to paint a single object with a known chain. */ void paint( HTMLChain *_chain, int x, int y, int w, int h ); /* * Internal function to paint a cell */ void paint( HTMLCellInfo * ); /* * Schedule a paint event. This is used internally to force a paint * event when, for example, an image has been loaded and the document * has been layed out again. */ void scheduleUpdate( bool clear ); /** * Internal use - calculates the absolute position of the objects. */ void calcAbsolutePos(); /* * return the map matching mapurl * For internal use only */ HTMLMap *getMap( const char *mapurl ); // Registers QImageIO handlers for JPEG and GIF static void registerFormats(); /** * @return a pointer to the @ref JSEnvironment instance used by this widget. * Every call to this function will result in the same pointer. * * @see #jsEnvironment */ JSEnvironment* getJSEnvironment(); /** * A convenience function to access the @ref JSWindowObject of this html * widget. * * @see #getJSEvironment */ JSWindowObject* getJSWindowObject(); /** * @return a list of all frames. * * @see #frameList */ QList<KHTMLWidget>* getFrameList() { return &frameList; } /** * Set document charset. * * Any <META ...> setting charsets overrides this setting * * @return TRUE if successfull * */ bool setCharset(const char *name); /** * set a charset, which will override the <meta ...> setting */ void setOverrideCharset(const char *name = 0); /** * Function used to return the current title */ QString *getTitle() {return &title;} /** * Function to clear the title */ void ClrTitle() {title = "";} //----------------------------------------------------------- // FUNCTIONS used for KFM Extension // ----------------------------------------------------------- bool setMarker( const char *_url ); bool selectFromMarker( const char *_url ); bool cellDown( bool select ); bool cellUp( bool select ); bool cellLeft( bool select ); bool cellRight( bool select ); void cellSelected(); void cellActivated(); void cellContextMenu(); void cellSequenceChanged(); // DF // reset the current key sequence (for instance when changing directory). DF void resetCurrentKeySeq() { currentKeySeq = ""; } //----------------------------------------------------------- // End KFM Extensions // ----------------------------------------------------------- // Another option to feed image data into the HTML Widget void data( const char *_url, const char *_data, int _len, bool _eof ); //for saving and restoring pages SavedPage *saveYourself(SavedPage *p = 0); void restore(SavedPage *); void restorePosition( int x, int y );protected: void buildFrameSet(SavedPage *p, QString *s); void buildFrameTree(SavedPage *p, HTMLFrameSet *f); int initialXPos; int initialYPos;public: signals: /** * This signal is emitted whenever the Widget wants to * change the window's title. Usually this is the text * enclosed in <tt><title>....</title></tt>. */ void setTitle( const char * ); /** * The user presse ALTd + Up */ void goUp(); /** * The user pressed ALT + Left */ void goLeft(); /** * The user pressed ALT + Right */ void goRight(); /** * The user double clicked on a URL. * * @param _url the URL that the user clicked on. * @param _button the mouse button that was used. */ void doubleClick( const char * _url, int _button); /** * Tells the parent, that the widget has scrolled. This may happen if * the user selects an <tt><a href="#anchor"></tt>. */ void scrollVert( int _y ); /** * Tells the parent, that the widget has scrolled. This may happen if * the user selects an <a href="#anchor">. */ void scrollHorz( int _x ); /** * Signals that a URL has been selected using a single click. * * @param _url is the URL clicked on. * @param _button is the mouse button clicked. */ void URLSelected( const char *_url, int _button ); /** * Signals that a URL has been selected using a single click. * * @param _url is the URL clicked on. * @param _button is the mouse button clicked. * @param _target is the target window or 0L if there is none. * ( Used to implement frames ). */ void URLSelected( const char *_url, int _button, const char *_target ); /** * Signals that the mouse cursor has moved on or off a URL. * * @param _url is the URL that the mouse cursor has moved onto. * _url is null if the cursor moved off a URL. */ void onURL( 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( bool _selected ); /** * Indicates the document has changed due to new URL loaded * or progressive update. This signal may be emitted several times * while the document is being parsed. It is an ideal opportunity * to update any scrollbars. */ void documentChanged(); /** * This signal is emitted if the widget got a call to @ref #parse * or @ref #begin. This indicates that the widget is working. * In a Web Browser you can use this to start an animated logo * like netscape does. The signal @ref #documentDone will tell * you that the widget finished its job. * * @see #documentDone */ void documentStarted(); /** * This signal is emitted when document is finished parsing * and all required images arrived. * * @see #documentStarted */ void documentDone(); /// Emitted if the user pressed the right mouse button /** * If the user pressed the right mouse button over a URL than _url * points to this URL, otherwise _url will be null. * The position is in global coordinates. */ void popupMenu( const char *_url, const QPoint & ); /** * This signal is emitted 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 null is there was none. * @param _target is the target frame if one is mentioned otherwise 0L. * @param _ev the @ref QMouseEvent. */ void mousePressed( const char *_url, const char *_target, QMouseEvent *_ev ); // The widget requests to load a file /** * KHTMLWidget can only load files from your local disk. If it * finds a object which requires a remote file, it will emit this * signal. If the file is loaded at some time, call @ref #slotFileLoaded. * * If the file is not needed any more, the signal @ref #cancelFileRequest * is emitted. * * @param _url is the URL of the image that needs to be loaded. */ void fileRequest( const char *_url ); // Cancels a file that has been requested. void cancelFileRequest( const char *_url ); // signal when user has submitted a form void formSubmitted( const char *_method, const char *_url, const char *_data ); // signal that the HTML Widget has changed size void resized( const QSize &size ); /** * used for url redirection */ void redirect( int delay, const char * url );#ifdef EXEC_EXTENSIONS void execfunc( const char *cmd);#endifpublic slots: /** * Scrolls the document to _y. * * This is usually connected to a scrollbar. */ void slotScrollVert( int _y ); /** * Scrolls the document to _x. * * This is usually connected to a scrollbar. */ void slotScrollHorz( int _x ); /** * Call when a file requested by @ref #fileRequest has been loaded. * * @param _url is the URL of the file that was requested. * @param _filename is the name of the file that has been stored on * the local filesystem. */ void slotFileLoaded( const char *_url, const char *_filename ); protected slots:// void slotTimeout(); void scrollBlobTimeout (); /* * INTERNAL * * Called when the widget needs an update. */ void slotUpdate(); /* * INTERNAL * * Called by timer event when the widget is due to autoscroll. */ void slotAutoScrollY(); /* * INTERNAL * * Used to update the selection when the user has caused autoscrolling * by dragging the mouse out of the widget bounds. */ void slotUpdateSelectText( int newy ); /* * INTERNAL * * Called when the user submitted a form. */ void slotFormSubmitted( const char *_method, const char *_url, const char *_data ); /* * INTERNAL * * Called if this widget displays a frameset and the user selected * one of the frames. In this case we have to unselect the * currently selected frame if there is one. */ void slotFrameSelected( KHTMLView *_view ); public: enum ListNumType { Numeric = 0, LowAlpha, UpAlpha, LowRoman, UpRoman }; enum ListType { Unordered, UnorderedPlain, Ordered, Menu, Dir };protected: virtual void mousePressEvent( QMouseEvent * ); virtual void mouseMoveEvent( QMouseEvent * ); void setBlob (QPoint pos); void clearBlob (); /** * This function emits the 'doubleClick' signal when the user * double clicks a <a href=...> tag. */ virtual void mouseDoubleClickEvent( QMouseEvent * ); /** * Overload this method if you dont want any drag actions. */ virtual void dndMouseMoveEvent( QMouseEvent * _mouse ); /** * This function emits the 'URLSelected' signal when the user * pressed a <a href=...> tag. */ virtual void dndMouseReleaseEvent( QMouseEvent * ); virtual void dragEndEvent(); /** * 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 ); virtual void paintEvent( QPaintEvent * ); virtual void resizeEvent( QResizeEvent * ); virtual void keyPressEvent( QKeyEvent * ); virtual void timerEvent( QTimerEvent * ); // we don't want global palette changes affecting us virtual void setPalette( const QPalette & ) {} // reimplemented to prevent flicker virtual void focusInEvent( QFocusEvent * ) { } virtual void focusOutEvent( QFocusEvent * ) { } // flush key presses from the event queue void flushKeys(); // do </a> if necessary void closeAnchor() {#ifdef EXEC_EXTENSIONS if(exec) { popColor(); popFont(); } exec = 0;#endif if ( url ) { popColor(); popFont(); } url = 0; target = 0; } /* * This function creates a new flow adds it to '_clue' and sets 'flow' */ void newFlow(HTMLClue *_clue); void insertText(char *str, const HTMLFont * fp); /* * This function is called after <body> usually. You can * call it for every rectangular area: For example a tables cell * or for a menus <li> tag. ht gives you one token after another. * _clue points to a VBox. All HTMLObjects created by this * function become direct or indirect children of _clue. * The last two parameters define which token signals the end * of the section this function should parse, for example </body>. * You can specify two tokens, for example </li> and </menu>. * You may even set the second one to "" if you dont need it. */ const char* parseBody( HTMLClueV *_clue, const char *[], bool toplevel = FALSE ); const char* parseOneToken( HTMLClueV *_clue, const char *str ); /* * Parse marks starting with character, e.g. * <img ... is processed by KHTMLWidget::parseI() * </ul> is processed by KHTMLWidget::parseU() */ void parseA( HTMLClueV *_clue, const char *str ); void parseB( HTMLClueV *_clue, const char *str ); void parseC( HTMLClueV *_clue, const char *str ); void parseD( HTMLClueV *_clue, const char *str ); void parseE( HTMLClueV *_clue, const char *str ); void parseF( HTMLClueV *_clue, const char *str ); void parseG( HTMLClueV *_clue, const char *str ); void parseH( HTMLClueV *_clue, const char *str ); void parseI( HTMLClueV *_clue, const char *str ); void parseJ( HTMLClueV *_clue, const char *str ); void parseK( HTMLClueV *_clue, const char *str ); void parseL( HTMLClueV *_clue, const char *str ); void parseM( HTMLClueV *_clue, const char *str ); void parseN( HTMLClueV *_clue, const char *str ); void parseO( HTMLClueV *_clue, const char *str ); void parseP( HTMLClueV *_clue, const char *str ); void parseQ( HTMLClueV *_clue, const char *str ); void parseR( HTMLClueV *_clue, const char *str ); void parseS( HTMLClueV *_clue, const char *str ); void parseT( HTMLClueV *_clue, const char *str ); void parseU( HTMLClueV *_clue, const char *str ); void parseV( HTMLClueV *_clue, const char *str ); void parseW( HTMLClueV *_clue, const char *str ); void parseX( HTMLClueV *_clue, const char *str ); void parseY( HTMLClueV *_clue, const char *str ); void parseZ( HTMLClueV *_clue, const char *str ); /* * This function is called after the <cell> tag. */ const char* parseCell( HTMLClue *_clue, const char *attr ); /* * parse table */ const char* parseTable( HTMLClue *_clue, int _max_width, const char * ); /* * parse input */ const char* parseInput( const char * ); /* * This function is used for convenience only. It inserts a vertical space * if this has not already been done. For example * <h1>Hello</h1><p>How are you ? * would insert a VSpace behind </h1> and one in front of <p>. This is one * VSpace too much. So we use 'space_inserted' to avoid this. Look at * 'parseBody' to see how to use this function. * Assign the return value to 'space_inserted'. */ bool insertVSpace( HTMLClueV *_clue, bool _space_inserted );public: /* * draw background area */ void drawBackground( int _xval, int _yval, int _x, int _y, int _w, int _h, QPainter *p = 0 );protected: /* * position form elements (widgets) on the page */ void positionFormElements(); /* * The current string formed by the sequence of key pressed */ QString currentKeySeq; /* * The <title>...</title>. */ QString title; /* * If we are in an <a href=..> ... </a> tag then the href * is stored in this string. */ char *url; /* * If we are in an <a target=..> ... </a> tag then this points to the * target. */ char *target;#ifdef EXEC_EXTENSIONS char *exec;#endif /* * This is the URL that the cursor is currently over */ QString overURL; /* * Reference (anchor) to jump to once it becomes available
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -