当前位置: 首页>>代码示例>>C++>>正文


C++ KHTMLView类代码示例

本文整理汇总了C++中KHTMLView的典型用法代码示例。如果您正苦于以下问题:C++ KHTMLView类的具体用法?C++ KHTMLView怎么用?C++ KHTMLView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KHTMLView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initMouseEvent

void MouseEventImpl::initMouseEvent(const DOMString &typeArg, bool canBubbleArg, bool cancelableArg, const AbstractView &viewArg, long detailArg,
                                    long screenXArg, long screenYArg, long clientXArg, long clientYArg, bool ctrlKeyArg, bool altKeyArg,
                                    bool shiftKeyArg, bool metaKeyArg, unsigned short buttonArg, const Node &relatedTargetArg)
{
    UIEventImpl::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);

    if(m_relatedTarget)
        m_relatedTarget->deref();

    m_screenX = screenXArg;
    m_screenY = screenYArg;
    m_clientX = clientXArg;
    m_clientY = clientYArg;
    m_pageX = clientXArg;
    m_pageY = clientYArg;
    KHTMLView *v;
    if(view() && view()->document() && (v = view()->document()->view()))
    {
        m_pageX += v->contentsX();
        m_pageY += v->contentsY();
    }
    m_ctrlKey = ctrlKeyArg;
    m_altKey = altKeyArg;
    m_shiftKey = shiftKeyArg;
    m_metaKey = metaKeyArg;
    m_button = buttonArg;
    m_relatedTarget = relatedTargetArg.handle();
    if(m_relatedTarget)
        m_relatedTarget->ref();


    // ### make this on-demand. its soo sloooow
    computeLayerPos();
    m_qevent = 0;
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: detach

void HTMLFrameElementImpl::setLocation(const DOMString &str)
{

    url = str;

    if(!attached())
        return;

    if(!m_render)
    {
        detach();
        attach();
        return;
    }

    if(!getDocument()->isURLAllowed(url.string()))
        return;

    // load the frame contents
    KHTMLView *w = getDocument()->view();
    if(w)
    {
        KHTMLPart *part = w->part()->findFrame(name.string());
        if(part)
        {
            part->openURL(KURL(getDocument()->completeURL(url.string())));
        }
        else
        {
            w->part()->requestFrame(static_cast< RenderFrame * >(m_render), url.string(), name.string());
        }
    }
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例3: kdDebug

void RenderFrame::slotViewCleared()
{
    if(element() && m_widget->inherits("QScrollView")) {
#ifdef DEBUG_LAYOUT
        kdDebug(6031) << "frame is a scrollview!" << endl;
#endif
        QScrollView *view = static_cast<QScrollView *>(m_widget);
        if(!element()->frameBorder || !((static_cast<HTMLFrameSetElementImpl *>(element()->parentNode()))->frameBorder()))
            view->setFrameStyle(QFrame::NoFrame);
#if APPLE_CHANGES
        // Qt creates QScrollView w/ a default style of QFrame::StyledPanel | QFrame::Sunken.
        else
            view->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

#else
        view->setHScrollBarMode(element()->scrolling );
        view->setVScrollBarMode(element()->scrolling );
#endif

        if(view->inherits("KHTMLView")) {
#ifdef DEBUG_LAYOUT
            kdDebug(6031) << "frame is a KHTMLview!" << endl;
#endif
            KHTMLView *htmlView = static_cast<KHTMLView *>(view);
            if(element()->marginWidth != -1) htmlView->setMarginWidth(element()->marginWidth);
            if(element()->marginHeight != -1) htmlView->setMarginHeight(element()->marginHeight);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:29,代码来源:render_frames.cpp

示例4: getDocument

void HTMLBodyElementImpl::insertedIntoDocument()
{
    HTMLElementImpl::insertedIntoDocument();

    KHTMLView *w = getDocument()->view();
    if(w && w->marginWidth() != -1)
    {
        QString s;
        s.sprintf("%d", w->marginWidth());
        addCSSLength(CSS_PROP_MARGIN_LEFT, s);
        addCSSLength(CSS_PROP_MARGIN_RIGHT, s);
    }
    if(w && w->marginHeight() != -1)
    {
        QString s;
        s.sprintf("%d", w->marginHeight());
        addCSSLength(CSS_PROP_MARGIN_TOP, s);
        addCSSLength(CSS_PROP_MARGIN_BOTTOM, s);
    }

    if(m_bgSet && !m_fgSet)
        addCSSProperty(CSS_PROP_COLOR, CSS_VAL_BLACK);

    if(m_styleSheet)
        getDocument()->updateStyleSelector();
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例5: write

static void write(QTextStream &ts, const RenderObject &o, int indent = 0)
{
    writeIndent(ts, indent);
    
    ts << o << "\n";
    
    if (o.isText() && !o.isBR()) {
        const RenderText &text = static_cast<const RenderText &>(o);
        for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
            writeIndent(ts, indent+1);
            writeTextRun(ts, text, *box);
        }
    }

    for (RenderObject *child = o.firstChild(); child; child = child->nextSibling()) {
        if (child->layer()) {
            continue;
        }
        write(ts, *child, indent + 1);
    }
    
    if (o.isWidget()) {
        QWidget *widget = static_cast<const RenderWidget &>(o).widget();
        if (widget && widget->inherits("KHTMLView")) {
            KHTMLView *view = static_cast<KHTMLView *>(widget);
            RenderObject *root = KWQ(view->part())->renderer();
            if (root) {
                view->layout();
                RenderLayer* l = root->layer();
                if (l)
                    writeLayers(ts, l, l, QRect(l->xPos(), l->yPos(), l->width(), l->height()), indent+1);
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:35,代码来源:KWQRenderTreeDebug.cpp

示例6: assert

void HTMLIFrameElementImpl::attach()
{
    assert(!attached());
    assert(!m_render);
    assert(parentNode());

    RenderStyle* _style = getDocument()->styleSelector()->styleForElement(this);
    _style->ref();
    if (isURLAllowed(url.string()) &&
        parentNode()->renderer() && _style->display() != NONE) {
        m_render = new RenderPartObject(this);
        m_render->setStyle(_style);
        parentNode()->renderer()->addChild(m_render, nextRenderer());
    }
    _style->deref();

    NodeBaseImpl::attach();

    if (m_render) {
        // we need a unique name for every frame in the frameset. Hope that's unique enough.
        KHTMLView* w = getDocument()->view();
        if(name.isEmpty() || w->part()->frameExists( name.string() ))
            name = DOMString(w->part()->requestFrameName());

        static_cast<RenderPartObject*>(m_render)->updateWidget();
        needWidgetUpdate = false;
    }
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:28,代码来源:html_baseimpl.cpp

示例7: xmlAllocOutputBuffer

DocumentImpl* XSLTProcessorImpl::documentFromXMLDocPtr(xmlDocPtr resultDoc, xsltStylesheetPtr sheet)
{
    // FIXME: For now we serialize and then reparse.  It might be more optimal to write a DOM
    // converter.
    if (!resultDoc || !sheet) return 0;
    DocumentImpl* result = 0;
    xmlOutputBufferPtr outputBuf = xmlAllocOutputBuffer(NULL);
    if (outputBuf) {
        outputBuf->context = this;
        outputBuf->writecallback = bufferWrite;
        
        if (xsltSaveResultTo(outputBuf, resultDoc, sheet) < 0)
            return 0;
        
        // There are three types of output we need to be able to deal with:
        // HTML (create an HTML document), XML (create an XML document), and text (wrap in a <pre> and
        // make an XML document).
        KHTMLView* view = m_sourceDocument->view();
        const xmlChar* method;
        XSLT_GET_IMPORT_PTR(method, sheet, method);
        if (method == NULL && resultDoc->type == XML_HTML_DOCUMENT_NODE)
            method = (const xmlChar*)"html";
        if (xmlStrEqual(method, (const xmlChar*)"html"))
            result = m_sourceDocument->implementation()->createHTMLDocument(view);
        else
            result = m_sourceDocument->implementation()->createDocument(view);
        result->attach();
        result->setURL(m_sourceDocument->URL());
        result->setBaseURL(m_sourceDocument->baseURL());
        result->setDecoder(m_sourceDocument->decoder()); // FIXME: Should just be UTF-16.
        result->docLoader()->setShowAnimations(m_sourceDocument->docLoader()->showAnimations());
        result->setTransformSourceDocument(m_sourceDocument);

        if (xmlStrEqual(method, (const xmlChar*)"text")) {
            // Modify the output so that it is a well-formed XHTML document with a <pre> tag enclosing
            // the text.
            QString beforeString("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<body>\n<pre>\n<![CDATA[");
            QString afterString("]]>\n</pre>\n</body>\n</html>\n");
            m_resultOutput = beforeString + m_resultOutput + afterString;
        }
        
        // Before parsing, we need to detach the old document completely and get the new document
        // in place.  We have to do this only if we're rendering the result document.
        if (view) {
            view->clear();
            view->part()->replaceDocImpl(result);
        }
        
        result->open();
        result->determineParseMode(m_resultOutput); // Make sure we parse in the correct mode.
        result->write(m_resultOutput);
        result->finishParsing();
        if (view)
            view->part()->checkCompleted();
        else
            result->close(); // FIXME: Even viewless docs can load subresources. onload will fire too early.
                             // This is probably a bug in XMLHttpRequestObjects as well.
    }
    return result;
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:60,代码来源:xslt_processorimpl.cpp

示例8: view

DOMString HTMLDocumentImpl::cookie() const
{
    long windowId = 0;
    KHTMLView *v = view();

    if(v && v->topLevelWidget())
        windowId = v->topLevelWidget()->winId();

    QCString replyType;
    QByteArray params, reply;
    QDataStream stream(params, IO_WriteOnly);
    stream << URL().url() << windowId;
    if(!kapp->dcopClient()->call("kcookiejar", "kcookiejar", "findDOMCookies(QString,long int)", params, replyType, reply))
    {
        kdWarning(6010) << "Can't communicate with cookiejar!" << endl;
        return DOMString();
    }

    QDataStream stream2(reply, IO_ReadOnly);
    if(replyType != "QString")
    {
        kdError(6010) << "DCOP function findDOMCookies(...) returns " << replyType << ", expected QString" << endl;
        return DOMString();
    }

    QString result;
    stream2 >> result;
    return DOMString(result);
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例9: getDocument

bool HTMLElementImpl::isURLAllowed(const QString& url) const
{
    KHTMLView *w = getDocument()->view();

    KURL newURL(getDocument()->completeURL(url));
    newURL.setRef(QString::null);

    // Prohibit non-file URLs if we are asked to.
    if (!w || w->part()->onlyLocalReferences() && newURL.protocol() != "file")
        return false;

    // do we allow this suburl ?
    if ( !kapp || !kapp->kapp->authorizeURLAction("redirect", w->part()->url(), newURL) )
        return false;

    // We allow one level of self-reference because some sites depend on that.
    // But we don't allow more than one.
    bool foundSelfReference = false;
    for (KHTMLPart *part = w->part(); part; part = part->parentPart()) {
        KURL partURL = part->url();
        partURL.setRef(QString::null);
        if (partURL == newURL) {
            if (foundSelfReference)
                return false;
            foundSelfReference = true;
        }
    }

    return true;
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:30,代码来源:html_elementimpl.cpp

示例10: getDocument

void HTMLFrameElementImpl::setLocation( const DOMString& str )
{
    url = str;
    KHTMLView* w = getDocument()->view();
    if ( m_render && w && w->part() )
        // don't call this for an iframe
        w->part()->requestFrame( static_cast<khtml::RenderFrame *>(m_render), url.string(), name.string() );
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:8,代码来源:html_baseimpl.cpp

示例11: assert

void HTMLFrameElementImpl::attach()
{
    assert(!attached());
    assert(parentNode());

    name = getAttribute(ATTR_NAME);
    if(name.isNull())
        name = getAttribute(ATTR_ID);

    // inherit default settings from parent frameset
    HTMLElementImpl *node = static_cast< HTMLElementImpl * >(parentNode());
    while(node)
    {
        if(node->id() == ID_FRAMESET)
        {
            HTMLFrameSetElementImpl *frameset = static_cast< HTMLFrameSetElementImpl * >(node);
            if(!frameBorderSet)
                frameBorder = frameset->frameBorder();
            if(!noresize)
                noresize = frameset->noResize();
            break;
        }
        node = static_cast< HTMLElementImpl * >(node->parentNode());
    }

    if(parentNode()->renderer() && getDocument()->isURLAllowed(url.string()))
    {
        RenderStyle *_style = getDocument()->styleSelector()->styleForElement(this);
        _style->ref();
        if(_style->display() != NONE)
        {
            m_render = new(getDocument()->renderArena()) RenderFrame(this);
            m_render->setStyle(_style);
            parentNode()->renderer()->addChild(m_render, nextRenderer());
        }
        _style->deref();
    }

    NodeBaseImpl::attach();

    if(!m_render)
        return;

    KHTMLView *w = getDocument()->view();
    if(w)
    {
        // we need a unique name for every frame in the frameset. Hope that's unique enough.
        if(name.isEmpty() || w->part()->frameExists(name.string()))
            name = DOMString(w->part()->requestFrameName());

        // load the frame contents
        w->part()->requestFrame(static_cast< RenderFrame * >(m_render), url.string(), name.string());
    }
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例12: setFrameStyle

void QFrame::setFrameStyle(int s)
{
    _frameStyle = s;

    // Tell the other side of the bridge about the frame style change.
    KHTMLView *view;
    if (this->inherits("KHTMLView")){
	view = static_cast<KHTMLView *>(this);
	if (view) {
	    KHTMLPart *part = view->part();
	    if (part) {
		KWQ(part)->bridge()->setHasBorder(s != NoFrame);
	    }
	}
    }
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:16,代码来源:KWQFrame.cpp

示例13: KonqPopupMenuPlugin

AkregatorMenu::AkregatorMenu( KonqPopupMenu * popupmenu, const char *name, const QStringList& /* list */ )
    : KonqPopupMenuPlugin( popupmenu, name), PluginBase(), m_conf(0), m_part(0)
{
    kdDebug() << "AkregatorMenu::AkregatorMenu()" << endl;
    if ( QCString( kapp->name() ) == "kdesktop" && !kapp->authorize("editable_desktop_icons" ) )
        return;

    // Do nothing if user has turned us off.
    // TODO: Not yet implemented in aKregator settings.
    /*m_conf = new KConfig( "akregatorrc" );
    m_conf->setGroup( "AkregatorKonqPlugin" );
    if ( !m_conf->readBoolEntry( "Enable", true ) )
        return;
    */
    
    KHTMLView* view = 0L;
          
    if (popupmenu && popupmenu->parent() && popupmenu->parent()->inherits("KHTMLView"))
            view = static_cast<KHTMLView*>(popupmenu->parent());
    
    if (view)
        m_part = view->part();
     
    KGlobal::locale()->insertCatalogue("akregator_konqplugin");
    m_feedMimeTypes << "text/rss" << "text/rdf" << "text/xml";
    // Get the list of URLs clicked on from Konqi.
    //KFileItemList m_list = popupmenu->fileItemList();
    // See if any are RSS feeds.
    
    KFileItemList list = popupmenu->fileItemList();
    KFileItem* it = list.first();
    while (it != 0)
    {
	if (isFeedUrl(it))
        {
	    kdDebug() << "AkregatorMenu: found feed URL " << it->url().prettyURL() << endl;
            KAction *action = new KAction( i18n( "Add Feed to Akregator" ), "akregator", 0, this, SLOT( slotAddFeed() ), actionCollection(), "akregatorkonqplugin_mnu" );
            addAction( action );
            addSeparator();
	    m_feedURL = it->url().url();
            break;
        }
	
	it = list.next();
    }
}
开发者ID:iegor,项目名称:kdesktop,代码行数:46,代码来源:akregatorplugin.cpp

示例14: SetViewColor

void RootView::AttachedToWindow()
{
	SetViewColor( 216,216,216 );
	mURLView->SetDivider( 40 );
	mTopView->show();
	
	AddChild( mURLView );
	AddChild( mTopView );
	AddChild( mStatusBar );

	KHTMLPart *htmlPart = new KHTMLPart( mTopView, "khtmlpart" );

	KHTMLView* pcView = htmlPart->view();
	
	BRect rect = mTopView->Bounds();
	pcView->SetResizingMode( B_FOLLOW_ALL );
	pcView->MoveTo( rect.LeftTop() );
	pcView->ResizeTo( rect.Width(), rect.Height() );
//	pcView->MakeFocus( true );
	pcView->SetTarget( BMessenger( Window() ) );
	pcView->show();
	
	BrowserWindow *bw = (BrowserWindow *)Window();
	bw->SetPart( htmlPart );
	bw->SetStatusBar( mStatusBar );
	bw->SetURLView( mURLView );
	
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:28,代码来源:main.cpp

示例15: slotForward

void KfmView::slotForward()
{
    if ( forwardStack->isEmpty() )
	return;

    SavedPage *s = forwardStack->pop();
    // try to find the corresponding htmlview. If only this view
    // (the one that changes saves itself, we will reduce flicker
    // a lot...
    
    // we are the top level widget, since we get signals from kfmgui
    KHTMLView *top = (KHTMLView *)this;
    KHTMLView *v;
    for ( v = viewList->first(); v != 0; v = viewList->next() )
    {
	if ( strcmp( v->getFrameName(), s->frameName ) == 0 ) 
	    if( top != v->findView( "_top" ) )
		continue;
	    else
		break;
    }
    if( !v ) v = top;

    SavedPage *p = v->saveYourself();
    backStack->push( p );
    
    if ( forwardStack->isEmpty() )
	emit historyUpdate( true, false );
    else
	emit historyUpdate( true, true );
    
    stackLock = true;
    restore( s );
    stackLock = false;

    delete s;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:37,代码来源:kfmview.cpp


注:本文中的KHTMLView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。