⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmlobj.h

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 H
📖 第 1 页 / 共 2 页
字号:
    virtual bool selectText( const QRegExp &exp );    virtual bool isSlave() const { return 1; }    virtual const char* getURL() const { return owner->getURL(); }    virtual const char* getTarget() const { return owner->getTarget(); }#ifdef EXEC_EXTENSIONS    virtual const char* getExec() const { return owner->getExec(); }#endifprotected:    int getCharIndex( int _xpos );protected:	HTMLTextMaster *owner;    short posStart;    short posLen;};//-----------------------------------------------------------------------------//// This object is text which also has an associated link.  This data is// not maintained in HTMLText to conserve memory.//class HTMLLinkText : public HTMLText{public:#ifdef EXEC_EXTENSIONS  HTMLLinkText(const char*_str,const HTMLFont *_font,QPainter *_painter,char *_url,const char *_target,char *_exec)    : HTMLText( _str, _font, _painter)    { url = _url; target = _target; exec = _exec;}#else  HTMLLinkText(const char*_str,const HTMLFont *_font,QPainter *_painter,char *_url,const char *_target)    : HTMLText( _str, _font, _painter)    { url = _url; target = _target;}#endif    virtual ~HTMLLinkText() { }    virtual const char* getURL() const { return url; }    virtual const char* getTarget() const { return target; }#ifdef EXEC_EXTENSIONS    virtual const char* getExec() const { return exec; }#endifprotected:    char *url;    const char *target;#ifdef EXEC_EXTENSIONS    char *exec;#endif};//-----------------------------------------------------------------------------//// This object is text which also has an associated link.  This data is// not maintained in HTMLTextMaster to conserve memory.//class HTMLLinkTextMaster : public HTMLTextMaster{public:#ifdef EXEC_EXTENSIONS  HTMLLinkTextMaster(const char*_str,const HTMLFont *_font,QPainter *_painter,char *_url,const char *_target,char *_exec)	: HTMLTextMaster( _str, _font, _painter)	    { url = _url; target = _target; exec = _exec;}#else  HTMLLinkTextMaster(const char*_str,const HTMLFont *_font,QPainter *_painter,char *_url,const char *_target)	: HTMLTextMaster( _str, _font, _painter)	    { url = _url; target = _target;}#endif    virtual ~HTMLLinkTextMaster() { }    virtual const char* getURL() const { return url; }    virtual const char* getTarget() const { return target; }#ifdef EXEC_EXTENSIONS    virtual const char* getExec() const { return exec; }#endifprotected:    char *url;    const char *target;#ifdef EXEC_EXTENSIONS    char *exec;#endif};//-----------------------------------------------------------------------------class HTMLRule : public HTMLObject{public:    HTMLRule( int _max_width, int _percent, int _size=1, bool _shade=TRUE );    virtual int  calcMinWidth();    virtual int  calcPreferredWidth() { return calcMinWidth(); }    virtual void setMaxWidth( int );    virtual bool print( QPainter *_painter, int _x, int _y, int _width,	int _height, int _tx, int _ty, bool toPrinter );    virtual void print( QPainter *, int _tx, int _ty );protected:    bool shade;};//-----------------------------------------------------------------------------class HTMLBullet : public HTMLObject{public:    HTMLBullet( int _height, int _level, const QColor &col );    virtual ~HTMLBullet() { }    virtual bool print( QPainter *_painter, int _x, int _y, int _width,	int _height, int _tx, int _ty, bool toPrinter );    virtual void print( QPainter *, int _tx, int _ty );protected:    char level;    QColor color;};//-----------------------------------------------------------------------------class HTMLVSpace : public HTMLObject{public:    enum Clear { CNone, Left, Right, All };    HTMLVSpace( int _vspace, Clear c = CNone );    virtual ~HTMLVSpace() { }    virtual void getSelectedText( QString & );    Clear clear()	{ return cl; }private:    Clear cl;};//-----------------------------------------------------------------------------// This class is inserted everywhere where a <a name="anchor">// appears.//class HTMLAnchor : public HTMLObject{public:    HTMLAnchor( const char *_name ) : name( _name ) {}    virtual ~HTMLAnchor() { }    const char* getName() { return name; }    virtual void setMaxAscent( int _a );    virtual HTMLAnchor* findAnchor( const char *_name, QPoint *_p );protected:    QString name;};//-----------------------------------------------------------------------------class HTMLCachedImage{public:    HTMLCachedImage( const char * );    virtual ~HTMLCachedImage() { }    QPixmap* getPixmap();    const char *getFileName() { return filename.data(); }protected:    QPixmap *pixmap;    QString filename;};//-----------------------------------------------------------------------------class HTMLImage : public QObject, public HTMLObject{    Q_OBJECTpublic:#ifdef EXEC_EXTENSIONS    HTMLImage(KHTMLWidget *widget,const char *,char *_url,char *_target,char *exec,int _max_width,int _width = -1,int _height = -1,int _percent = 0,int bdr = 0);#else    HTMLImage(KHTMLWidget *widget,const char *,char *_url,char *_target,int _max_width,int _width = -1,int _height = -1,int _percent = 0,int bdr = 0);#endif    virtual ~HTMLImage();    virtual int  calcMinWidth();    virtual int  calcPreferredWidth();    virtual void setMaxWidth( int );    virtual bool print( QPainter *_painter, int _x, int _y, int _width,	int _height, int _tx, int _ty, bool toPrinter );    virtual void print( QPainter *, int _tx, int _ty );    virtual void calcAbsolutePos( int _x, int _y );    virtual int  getAbsX();    virtual int  getAbsY();    virtual void changeImage( const char *_url );      void setOverlay( const char *ol );    static void cacheImage( const char * );    static QPixmap* findImage( const char * );    /* Tells the object the the requested image is available     *     * The image is on the local disk in the file named '_filename.'     */    virtual void fileLoaded( const char *_filename );    virtual bool fileLoaded( const char* _url, QBuffer& _buffer );    virtual const char *requestedFile()       	{	return imageURL.data(); }    virtual const char* getURL() const { return url; }    virtual const char* getTarget() const { return target; }#ifdef EXEC_EXTENSIONS    virtual const char* getExec() const { return exec; }#endif    void setBorderColor( const QColor &color )	{   borderColor = color; }    virtual void setBgColor( QColor c );protected slots:    void movieUpdated( const QRect &rect );    void statusChanged( int );protected:    /*     * Calculates the size of the loaded image.     * This function is usually called from the constructor or from     * 'imageLoaded'.     */    void init();        /*     * Pointer to the image     * If this pointer is 0L, that means that the picture could not be loaded     * for some strange reason or that the image is waiting to be downloaded     * from the internet for example.     */    QPixmap *pixmap;    QPixmap *movieCache;    QRect oldRect;    QColor bgColor;#ifdef USE_QMOVIE    QMovie *movie;#else    void *movie;#endif    // this image is overlaid on top of the image.    // Used by HTML widget to show links/read only files, etc.    QPixmap *overlay;    /*     * The URL of this image.     * This variable is only used if we have to wait for the image.     * Otherwise this string will be empty.     */    QString imageURL;        KHTMLWidget *htmlWidget;        static QDict<HTMLCachedImage>* pCache;    /*     * Flag telling wether this image was found in the cache     * If this flag is set, you may not delete the pixmap since the pixmap     * belongs to the HTMLCachedImage.     */    bool cached;    /*     * If we knew the size of the image from the <img width=...> tag then this     * flag is TRUE.     * We need this flag if the image has to be loaded from the web. In this     * case we may have to reparse the HTML code if we did not know the size     * during the first parsing.     */    bool predefinedWidth;    /*     * If we knew the size of the image from the <img height=...> tag then     * this flag is TRUE.     * We need this flag if the image has to be loaded from the web. In this     * case we may have to reparse the HTML code if we did not know the size     * during the first parsing.     */    bool predefinedHeight;    /*     * Tells the function 'imageLoaded' wether it runs synchronized with the     * constructor     * If an image has to be loaded from the net, it may happen that the image     * is cached.  This means the the function 'imageLoaded' is called before     * the control returns to the constructor, since the constructor requested     * the image and this caused in turn 'imageLoaded' to be called. In this     * case the images arrived just in time and no repaint or recalculate     * action must take place. If 'imageLoaded' works synchron with     * the constructor then this flag is set to TRUE.     */    bool synchron;    // border width    int border;    QColor borderColor;    char *url;    char *target;#ifdef EXEC_EXTENSIONS    char *exec;#endif    // The absolute position of this object on the page    int absX;    int absY;    bool bComplete;};//----------------------------------------------------------------------------/* * HTMLArea holds an area as specified by the <AREA > tag. */class HTMLArea{public:    HTMLArea( const QPointArray &_points, const char *_url,	    const char *_target = 0 );    HTMLArea( const QRect &_rect, const char *_url, const char *_target = 0 );    HTMLArea( int _x, int _y, int _r, const char *_url,	    const char *_target = 0 );    enum Shape { Poly, Rect, Circle };    bool contains( const QPoint &_point ) const	    {	return region.contains( _point ); }    const QString &getURL() const	    {	return url; }    const char *getTarget() const	    {	return target; }protected:    QRegion region;    QString url;    QString target;};//----------------------------------------------------------------------------/* * HTMLMap contains a list of areas in the image map. * i.e. all areas between <MAP > </MAP> * This object is derived from HTMLObject so that it can make use of * URLLoaded(). */class HTMLMap : public HTMLObject{public:    HTMLMap( KHTMLWidget *w, const char *_url );    virtual ~HTMLMap();    virtual void fileLoaded( const char *_filename );    virtual bool fileLoaded( const char* _url, QBuffer& _buffer );    virtual const char *requestedFile()	    {	return mapurl; }    void addArea( HTMLArea *_area )	    {	areas.append( _area ); }    const HTMLArea *containsPoint( int, int );    const char *mapURL() const	    {	return mapurl; }protected:    bool fileLoaded( QIODevice& file );      QList<HTMLArea> areas;    KHTMLWidget *htmlWidget;    QString mapurl;};//----------------------------------------------------------------------------class HTMLImageMap : public HTMLImage{public:#ifdef EXEC_EXTENSIONS  HTMLImageMap(KHTMLWidget *widget,const char*,char *_url,char *_target,char *_exec,int _max_width,int _width = -1,int _height = -1,int _percent = 0,int brd = 0);#else  HTMLImageMap(KHTMLWidget *widget,const char*,char *_url,char *_target,int _max_width,int _width = -1,int _height = -1,int _percent = 0,int brd = 0);#endif    virtual ~HTMLImageMap() {}    virtual HTMLObject* checkPoint( int, int );    void setMapURL( const char *_url )	    {	mapurl = _url; }    const QString& mapURL() const	    {	return mapurl; }    enum Type { ClientSide, ServerSide };    void setMapType( Type t )	    {	type = t; }    bool mapType() const	    {	return type; }protected:    /*     * The URL set by <a href=...><img ... ISMAP></a> for server side maps     */    QString serverurl;    /*     * The URL set by <img ... USEMAP=mapurl> for client side maps     */    QString mapurl;    /*     * ClientSide or ServerSide     */    Type type;};//----------------------------------------------------------------------------#endif // HTMLOBJ

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -