1998-05-11 22:52:40 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
1998-05-11 22:52:40 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* 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.
|
1998-05-11 22:52:40 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-05-11 22:52:40 +00:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:40:37 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-05-11 22:52:40 +00:00
|
|
|
*/
|
|
|
|
#ifndef nsIFrameImageLoader_h___
|
|
|
|
#define nsIFrameImageLoader_h___
|
|
|
|
|
|
|
|
#include "nslayout.h"
|
1999-04-13 21:49:01 +00:00
|
|
|
#include "nsISupports.h"
|
1998-07-16 17:09:26 +00:00
|
|
|
#include "nsColor.h"
|
1999-04-13 21:49:01 +00:00
|
|
|
|
1998-05-11 22:52:40 +00:00
|
|
|
class nsIFrame;
|
|
|
|
class nsIImage;
|
|
|
|
class nsIImageGroup;
|
|
|
|
class nsIPresContext;
|
|
|
|
class nsString;
|
|
|
|
struct nsSize;
|
|
|
|
|
1999-04-13 21:49:01 +00:00
|
|
|
/* a6cf90ec-15b3-11d2-932e-00805f8add32 */
|
1998-05-11 22:52:40 +00:00
|
|
|
#define NS_IFRAME_IMAGE_LOADER_IID \
|
1999-04-13 21:49:01 +00:00
|
|
|
{ 0xa6cf90ec, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
1998-09-26 18:36:59 +00:00
|
|
|
|
2000-05-13 01:39:20 +00:00
|
|
|
enum nsImageAnimation {
|
|
|
|
eImageAnimation_Normal = 0, // looping controlled by image
|
|
|
|
eImageAnimation_None = 1, // don't loop; just show first frame
|
|
|
|
eImageAnimation_LoopOnce = 2 // loop just once
|
|
|
|
};
|
|
|
|
|
1998-09-26 18:36:59 +00:00
|
|
|
// Type of callback function used during image loading. The frame
|
|
|
|
// image loader will invoke this callback as notifications occur from
|
|
|
|
// the image library.
|
1999-04-13 21:49:01 +00:00
|
|
|
class nsIFrameImageLoader;
|
|
|
|
typedef nsresult (*nsIFrameImageLoaderCB)(nsIPresContext* aPresContext,
|
|
|
|
nsIFrameImageLoader* aLoader,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
void* aClosure,
|
|
|
|
PRUint32 aStatus);
|
1998-09-26 18:36:59 +00:00
|
|
|
|
1998-05-11 22:52:40 +00:00
|
|
|
/**
|
|
|
|
* Abstract interface for frame image loaders. Frame image loaders
|
|
|
|
* know how to respond to nsIImageRequestObserver notifications and
|
|
|
|
* generate the appropriate rendering/reflow operation for a target
|
|
|
|
* frame.
|
|
|
|
*/
|
1999-04-13 21:49:01 +00:00
|
|
|
class nsIFrameImageLoader : public nsISupports {
|
1998-05-11 22:52:40 +00:00
|
|
|
public:
|
2000-03-25 07:09:25 +00:00
|
|
|
static const nsIID& GetIID() {static nsIID iid = NS_IFRAME_IMAGE_LOADER_IID; return iid;}
|
|
|
|
|
1998-05-11 22:52:40 +00:00
|
|
|
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
|
|
|
nsIImageGroup* aGroup,
|
|
|
|
const nsString& aURL,
|
1998-07-16 04:34:59 +00:00
|
|
|
const nscolor* aBackgroundColor,
|
1999-04-13 21:49:01 +00:00
|
|
|
const nsSize* aDesiredSize,
|
|
|
|
nsIFrame* aFrame,
|
2000-05-13 01:39:20 +00:00
|
|
|
nsImageAnimation aAnimationMode,
|
1999-04-13 21:49:01 +00:00
|
|
|
nsIFrameImageLoaderCB aCallBack,
|
2000-09-01 07:05:08 +00:00
|
|
|
void* aClosure, void* aKey) = 0;
|
1998-05-11 22:52:40 +00:00
|
|
|
|
2000-09-21 01:20:00 +00:00
|
|
|
NS_IMETHOD StopImageLoad(PRBool aStopChrome = PR_TRUE) = 0;
|
1998-05-12 01:28:31 +00:00
|
|
|
|
|
|
|
NS_IMETHOD AbortImageLoad() = 0;
|
|
|
|
|
1999-04-13 21:49:01 +00:00
|
|
|
NS_IMETHOD IsSameImageRequest(const nsString& aURL,
|
|
|
|
const nscolor* aBackgroundColor,
|
|
|
|
const nsSize* aDesiredSize,
|
|
|
|
PRBool* aResult) = 0;
|
|
|
|
|
|
|
|
NS_IMETHOD AddFrame(nsIFrame* aFrame, nsIFrameImageLoaderCB aCallBack,
|
2000-09-01 07:05:08 +00:00
|
|
|
void* aClosure, void* aKey) = 0;
|
1999-04-13 21:49:01 +00:00
|
|
|
|
2000-09-01 07:05:08 +00:00
|
|
|
NS_IMETHOD RemoveFrame(void* aKey) = 0;
|
1999-04-13 21:49:01 +00:00
|
|
|
|
|
|
|
NS_IMETHOD SafeToDestroy(PRBool* aResult) = 0;
|
1998-05-11 22:52:40 +00:00
|
|
|
|
1999-04-13 21:49:01 +00:00
|
|
|
NS_IMETHOD GetURL(nsString& aResult) = 0;
|
2000-03-25 07:09:25 +00:00
|
|
|
NS_IMETHOD GetPresContext(nsIPresContext** aPresContext) = 0;
|
1998-05-11 22:52:40 +00:00
|
|
|
|
1999-04-13 21:49:01 +00:00
|
|
|
NS_IMETHOD GetImage(nsIImage** aResult) = 0;
|
1998-05-11 22:52:40 +00:00
|
|
|
|
1999-04-13 21:49:01 +00:00
|
|
|
// Return the size of the image, in twips
|
|
|
|
NS_IMETHOD GetSize(nsSize& aResult) = 0;
|
1998-05-11 22:52:40 +00:00
|
|
|
|
1999-04-13 21:49:01 +00:00
|
|
|
NS_IMETHOD GetImageLoadStatus(PRUint32* aLoadStatus) = 0;
|
2000-04-15 15:49:03 +00:00
|
|
|
|
|
|
|
// Return the intrinsic (or natural) size of the image, in twips.
|
|
|
|
// Returns 0,0 if the dimensions are unknown
|
|
|
|
NS_IMETHOD GetIntrinsicSize(nsSize& aResult) = 0;
|
2000-09-08 22:46:24 +00:00
|
|
|
NS_IMETHOD GetNaturalImageSize(PRUint32* naturalWidth, PRUint32 *naturalHeight) = 0;
|
1998-05-11 22:52:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Image load status bit values
|
1999-02-04 17:03:46 +00:00
|
|
|
#define NS_IMAGE_LOAD_STATUS_NONE 0x0
|
1999-04-13 21:49:01 +00:00
|
|
|
#define NS_IMAGE_LOAD_STATUS_SIZE_AVAILABLE 0x1
|
|
|
|
#define NS_IMAGE_LOAD_STATUS_IMAGE_READY 0x2
|
|
|
|
#define NS_IMAGE_LOAD_STATUS_ERROR 0x4
|
1998-05-11 22:52:40 +00:00
|
|
|
|
|
|
|
#endif /* nsIFrameImageLoader_h___ */
|