/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 * 
 * The Original Code is mozilla.org code.
 * 
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation. Portions created by Netscape are
 * Copyright (C) 2001 Netscape Communications Corporation. All
 * Rights Reserved.
 * 
 * Contributor(s): 
 *   Stuart Parmenter <pavlov@netscape.com>
 */

#include "imgIContainerObserver.idl"

interface imgIRequest;
interface imgIContainer;
interface gfxIImageFrame;

%{C++
#include "nsRect.h"
%}

/**
 * imgIDecoderObserver interface
 *
 * @author Stuart Parmenter <pavlov@netscape.com>
 * @version 0.1
 * @see imagelib2
 */
[scriptable, uuid(350163d2-1dd2-11b2-9e69-89959ecec1f3)]
interface imgIDecoderObserver : imgIContainerObserver
{
  /**
   * called as soon as the image begins getting decoded
   */
  void onStartDecode(in imgIRequest aRequest, in nsISupports cx);

  /**
   * called once the image has been inited and therefore has a width and height
   */
  void onStartContainer(in imgIRequest aRequest, in nsISupports cx, in imgIContainer aContainer);

  /**
   * called when each frame is created
   */
  void onStartFrame(in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame);

  /**
   * called when some part of the frame has new data in it
   */
  [noscript] void onDataAvailable(in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame, [const] in nsRect aRect);

  /**
   * called when a frame is finished decoding
   */
  void onStopFrame(in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame);

  /**
   * probably not needed.  called right before onStopDecode
   */
  void onStopContainer(in imgIRequest aRequest, in nsISupports cx, in imgIContainer aContainer);

  /**
   * called when the decoder is dying off
   */
  void onStopDecode(in imgIRequest aRequest, in nsISupports cx,
                    in nsresult status, in wstring statusArg);

};
