Source Code (Use browser search to find items of interest.)

Class Index

kdelibs'HTMLAppletElementImpl (./kdelibs/khtml/html/html_objectimpl.h:38)

class HTMLAppletElementImpl : public HTMLElementImpl
{
public:
    HTMLAppletElementImpl(DocumentImpl *doc);

    ~HTMLAppletElementImpl();

    virtual const DOMString nodeName() const;
    virtual ushort id() const;

    virtual tagStatus startTag() { return APPLETStartTag; }
    virtual tagStatus endTag() { return APPLETEndTag; }

    virtual void parseAttribute(Attribute *token);

    virtual void attach(KHTMLView *w);
    virtual void detach();

    virtual khtml::VAlign vAlign() { return valign; }

protected:
    DOMStringImpl *codeBase;
    DOMStringImpl *name;
    DOMStringImpl *code;
    DOMStringImpl *archive;
    int width;
    int height;

    KHTMLView *view;
    khtml::VAlign valign;
};

// -------------------------------------------------------------------------


kdelibs'HTMLAppletElementImpl::HTMLAppletElementImpl() (./kdelibs/khtml/html/html_objectimpl.cpp:47)

HTMLAppletElementImpl::HTMLAppletElementImpl(DocumentImpl *doc)
  : HTMLElementImpl(doc)
{
    codeBase = 0;
    code = 0;
    name = 0;
    archive = 0;
    width = height = 0;
}


kdelibs'HTMLAppletElementImpl::~HTMLAppletElementImpl() (./kdelibs/khtml/html/html_objectimpl.cpp:57)

HTMLAppletElementImpl::~HTMLAppletElementImpl()
{
    if(codeBase) codeBase->deref();
    if(code) code->deref();
    if(name) name->deref();
    if(archive) archive->deref();
}


kdelibs'HTMLAppletElementImpl::nodeName() (./kdelibs/khtml/html/html_objectimpl.cpp:65)

const DOMString HTMLAppletElementImpl::nodeName() const
{
    return "APPLET";
}


kdelibs'HTMLAppletElementImpl::id() (./kdelibs/khtml/html/html_objectimpl.cpp:70)

ushort HTMLAppletElementImpl::id() const
{
    return ID_APPLET;
}


kdelibs'HTMLAppletElementImpl::parseAttribute() (./kdelibs/khtml/html/html_objectimpl.cpp:75)

void HTMLAppletElementImpl::parseAttribute(Attribute *attr)
{
    switch( attr->id )
    {
    case ATTR_CODEBASE:
    	codeBase = attr->val();
	codeBase->ref();
	break;	
    case ATTR_ARCHIVE:
        archive = attr->val();
        archive->ref();
        break;
    case ATTR_CODE:
	code = attr->val();
	code->ref();
	break;	
    case ATTR_OBJECT:
	break;
    case ATTR_ALT:
	break;
    case ATTR_NAME:
	name = attr->val();
	name->ref();
	break;
    case ATTR_WIDTH:
        width = attr->val()->toInt();
	break;
    case ATTR_HEIGHT:
	height = attr->val()->toInt();
	break;
    case ATTR_ALIGN:
	// vertical alignment with respect to the current baseline of the text
	// right or left means floating images
	if ( strcasecmp( attr->value(), "left" ) == 0 )
	{
	    addCSSProperty(CSS_PROP_FLOAT, attr->value(), false);
	    valign = khtml::Top;
	}
	else if ( strcasecmp( attr->value(), "right" ) == 0 )
	{
	    addCSSProperty(CSS_PROP_FLOAT, attr->value(), false);
	    valign = khtml::Top;
	}
	else if ( strcasecmp( attr->value(), "top" ) == 0 )
	    valign = khtml::Top;
	else if ( strcasecmp( attr->value(), "middle" ) == 0 )
	    valign = khtml::VCenter;
	else if ( strcasecmp( attr->value(), "bottom" ) == 0 )
	    valign = khtml::Bottom;
	break;
    default:
	HTMLElementImpl::parseAttribute(attr);
    }
}


kdelibs'HTMLAppletElementImpl::attach() (./kdelibs/khtml/html/html_objectimpl.cpp:130)

void HTMLAppletElementImpl::attach(KHTMLView *_view)
{
  if(!code)
      return;

  khtml::RenderObject *r = _parent->renderer();
  if(!r)
      return;

  m_style = document->styleSelector()->styleForElement(this);
  view = _view;
  RenderWidget *f;

  if( view->part()->javaEnabled() )
  {
      QMap<QString, QString> args;

      args.insert( "code", QString(code->s, code->l));
      if(codeBase)
          args.insert( "codeBase", QString(codeBase->s, codeBase->l) );
      if(name)
          args.insert( "name", QString(name->s, name->l) );
      if(archive)
          args.insert( "archive", QString(archive->s, archive->l) );

      args.insert( "width", QString::number(width) );
      args.insert( "height", QString::number(height) );
      args.insert( "baseURL", view->part()->url().url() );

      f = new RenderApplet(view, args, this);
  }
  else
      f = new RenderEmptyApplet(view, QSize(width, height));

  if(f)
  {
      m_render = f;
      m_render->setStyle(m_style);
      m_render->ref();
      r->addChild(m_render);
  }
}


kdelibs'HTMLAppletElementImpl::detach() (./kdelibs/khtml/html/html_objectimpl.cpp:173)

void HTMLAppletElementImpl::detach()
{
    view = 0;
    NodeBaseImpl::detach();
}

// -------------------------------------------------------------------------