Ejemplo n.º 1
0
void RenderApplet::layout()
{
    //kdDebug(6100) << "RenderApplet::layout" << endl;

    KHTMLAssert( needsLayout() );
    KHTMLAssert( minMaxKnown() );

    calcWidth();
    calcHeight();

    KJavaAppletWidget *tmp = static_cast<KJavaAppletWidget*>(m_widget);
    if ( tmp ) {
        NodeImpl *child = element()->firstChild();

        while(child) {

            if(child->id() == ID_PARAM) {
                HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
                if(tmp->applet())
                    tmp->applet()->setParameter( p->name(), p->value());
            }
            child = child->nextSibling();
        }
        //kdDebug(6100) << "setting applet widget to size: " << m_width << ", " << m_height << endl;
        m_widget->resize(m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
                         m_height-borderTop()-borderBottom()-paddingTop()-paddingBottom());
        tmp->showApplet();
    }

    setNeedsLayout(false);
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
    KCmdLineArgs::init( argc, argv, "testKJASSever", 0, ki18n("testKJASServer"), "0.0", ki18n("test program"));

    KCmdLineOptions options;
    options.add("+kdelibspath", ki18n("path to kdelibs directory"));

    KCmdLineArgs::addCmdLineOptions( options );
    //KCmdLineArgs::addStdCmdLineOptions();

    KApplication app;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    QByteArray path;
#if 0
    path = args->getOption("kdelibspath");
    if (path.isEmpty())
    {
      kWarning() << "you need to specify a path to your kdelibs source dir, see \"--help\"";
      return -1;
    }
#else
    #ifdef __GNUC__
    #warning better adjust this :)
    #endif
    path = "/home/danimo/src/kde/trunk/KDE/kdelibs/";
#endif
    QString testpath("file://" + path + "/kdelibs/khtml/test/");

    KJavaAppletContext *context = new KJavaAppletContext;
    KJavaAppletWidget *a = new KJavaAppletWidget;
    a->applet()->setAppletContext(context);

    a->show();

//    c->registerApplet(a->applet());

    a->applet()->setBaseURL( testpath );
    a->applet()->setAppletName( "Lake" );
    a->applet()->setAppletClass( "lake.class" );
    a->applet()->setParameter( "image", "konqi.gif" );

    a->showApplet();
    a->applet()->start();

    app.exec();
}