/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"
#include "nspluginroot.idl"

%{C++
enum nsPluginTagType {
  nsPluginTagType_Unknown,
  nsPluginTagType_Embed,
  nsPluginTagType_Object,
  nsPluginTagType_Applet
};
%}

native nsPluginTagType(nsPluginTagType);

interface nsIDOMElement;

/**
 * Plugin Tag Info Interface
 * This interface provides information about the HTML tag on the page.
 * Some day this might get superseded by a DOM API.
 */

[uuid(ED83A4D9-77D2-40EA-B140-F160EDB3FE1C)]
interface nsIPluginTagInfo : nsISupports
{
  /**
   * QueryInterface on nsIPluginInstancePeer to get this.
   *
   * (Corresponds to NPP_New's argc, argn, and argv arguments.)
   * Get a ptr to the paired list of attribute names and values,
   * returns the length of the array.
   *
   * Each name or value is a null-terminated string.
   */
  void getAttributes(in PRUint16Ref aCount,
                     in constCharStarConstStar aNames,
                     in constCharStarConstStar aValues);

  /**
   * Gets the value for the named attribute.
   *
   * @param aName   - the name of the attribute to find
   * @param aResult - the resulting attribute
   * @result - NS_OK if this operation was successful, NS_ERROR_FAILURE if
   * this operation failed. result is set to NULL if the attribute is not found
   * else to the found value.
   */
  void getAttribute(in string aName, out constCharPtr aResult);

  /**
   * Get the type of the HTML tag that was used ot instantiate this
   * plugin.  Currently supported tags are EMBED, OBJECT and APPLET.
   */
  readonly attribute nsPluginTagType tagType;

  /**
   * Get the complete text of the HTML tag that was used to instantiate this plugin.
   */
  void getTagText(out constCharPtr aTagText);

  /**
   * Get a ptr to the paired list of parameter names and values,
   * returns the length of the array.
   *
   * Each name or value is a null-terminated string.
   */
  void getParameters(in PRUint16Ref aCount,
                     in constCharStarConstStar aNames,
                     in constCharStarConstStar aValues);

  /**
   * Get the value for the named parameter.  Returns null
   * if the parameter was not set.
   *
   * @param aName   - name of the parameter
   * @param aResult - parameter value
   * @result        - NS_OK if this operation was successful
   */
  void getParameter(in string aName, out constCharPtr aResult);

  /**
   * Get the document base
   */
  void getDocumentBase(out constCharPtr aDocumentBase);
    
  /**
   * Return an encoding whose name is specified in:
   * http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303
   */
  void getDocumentEncoding(out constCharPtr aDocumentEncoding);

  /**
   * Get object alignment
   */
  void getAlignment(out constCharPtr aElignment);

  /**
   * Get object width
   */
  readonly attribute unsigned long width;

  /**
   * Get object height
   */
  readonly attribute unsigned long height;

  /**
   * Get border vertical space
   */
  readonly attribute unsigned long borderVertSpace;

  /**
   * Get border horizontal space
   */
  readonly attribute unsigned long borderHorizSpace;

  /**
   * Returns the DOM element corresponding to the tag which references
   * this plugin in the document.
   *
   * @param aDOMElement - resulting DOM element
   * @result - NS_OK if this operation was successful
   */
  readonly attribute nsIDOMElement DOMElement;
};
