1998-04-13 20:24:54 +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-04-13 20:24:54 +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-04-13 20:24:54 +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-04-13 20:24:54 +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-04-13 20:24:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsIView_h___
|
|
|
|
#define nsIView_h___
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsCoord.h"
|
2001-07-16 02:40:48 +00:00
|
|
|
#include "nsEvent.h"
|
|
|
|
|
|
|
|
struct nsGUIEvent;
|
|
|
|
class nsIWidget;
|
|
|
|
struct nsWidgetInitData;
|
|
|
|
typedef void* nsNativeWidget;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
class nsIViewManager;
|
1998-05-18 21:46:20 +00:00
|
|
|
class nsIRegion;
|
1998-04-13 20:24:54 +00:00
|
|
|
class nsIRenderingContext;
|
|
|
|
class nsTransform2D;
|
|
|
|
class nsIFrame;
|
1998-08-28 03:05:23 +00:00
|
|
|
class nsIViewObserver;
|
1998-10-11 01:00:59 +00:00
|
|
|
class nsVoidArray;
|
1998-04-13 20:24:54 +00:00
|
|
|
struct nsRect;
|
|
|
|
|
1998-04-29 02:24:07 +00:00
|
|
|
//this is used by the view clipping APIs since the description of
|
|
|
|
//a clip rect is different than a rect
|
|
|
|
|
1999-09-23 23:26:54 +00:00
|
|
|
struct nsViewClip {
|
1998-04-29 02:24:07 +00:00
|
|
|
nscoord mLeft;
|
|
|
|
nscoord mRight;
|
|
|
|
nscoord mTop;
|
|
|
|
nscoord mBottom;
|
1999-09-23 23:26:54 +00:00
|
|
|
};
|
1998-04-29 02:24:07 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// Enumerated type to indicate the visibility of a layer.
|
|
|
|
// hide - the layer is not shown.
|
|
|
|
// show - the layer is shown irrespective of the visibility of
|
|
|
|
// the layer's parent.
|
|
|
|
// inherit - the layer inherits its visibility from its parent.
|
1999-09-23 23:26:54 +00:00
|
|
|
enum nsViewVisibility {
|
1998-04-13 20:24:54 +00:00
|
|
|
nsViewVisibility_kHide = 0,
|
|
|
|
nsViewVisibility_kShow = 1,
|
|
|
|
nsViewVisibility_kInherit = 2
|
1999-09-23 23:26:54 +00:00
|
|
|
};
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
// IID for the nsIView interface
|
|
|
|
#define NS_IVIEW_IID \
|
|
|
|
{ 0xf0a21c40, 0xa7e1, 0x11d1, \
|
|
|
|
{ 0xa8, 0x24, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
1998-08-08 04:23:33 +00:00
|
|
|
/**
|
|
|
|
* View interface
|
|
|
|
*
|
|
|
|
* Views are NOT reference counted. Use the Destroy() member function to
|
|
|
|
* destroy a frame.
|
|
|
|
*
|
|
|
|
* The lifetime of the view hierarchy is bounded by the lifetime of the
|
|
|
|
* view manager that owns the views.
|
|
|
|
*/
|
1998-04-13 20:24:54 +00:00
|
|
|
class nsIView : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
1999-08-28 03:01:32 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IVIEW_IID)
|
1999-06-24 22:40:53 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Initialize the view
|
1998-08-08 04:23:33 +00:00
|
|
|
* @param aManager view manager that "owns" the view. The view does NOT
|
|
|
|
* hold a reference to the view manager
|
1998-04-15 20:25:02 +00:00
|
|
|
* @param aBounds initial bounds for view
|
1998-10-27 03:36:49 +00:00
|
|
|
* @param aParent intended parent for view. this is not actually set in the
|
|
|
|
* nsIView through this method. it is only used by the initialization
|
|
|
|
* code to walk up the view tree, if necessary, to find resources.
|
1998-04-15 20:25:02 +00:00
|
|
|
* @param aVisibilityFlag initial visibility state of view
|
|
|
|
* @result The result of the initialization, NS_OK if no errors
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD Init(nsIViewManager* aManager,
|
|
|
|
const nsRect &aBounds,
|
1998-10-27 03:36:49 +00:00
|
|
|
const nsIView *aParent,
|
1998-08-30 19:16:11 +00:00
|
|
|
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
1998-08-08 04:23:33 +00:00
|
|
|
* Destroy the view.
|
|
|
|
*
|
|
|
|
* The view destroys its child views, and destroys and releases its
|
|
|
|
* widget (if it has one).
|
|
|
|
*
|
|
|
|
* Also informs the view manager that the view is destroyed by calling
|
|
|
|
* SetRootView(NULL) if the view is the root view and calling RemoveChild()
|
|
|
|
* otherwise.
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD Destroy() = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Get the view manager the "owns" the view
|
|
|
|
* @result view manager
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetViewManager(nsIViewManager *&aViewMgr) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Called to indicate that the specified rect of the view
|
|
|
|
* needs to be drawn via the rendering context. The rect
|
|
|
|
* is specified in view coordinates.
|
|
|
|
* @param rc rendering context to paint into
|
|
|
|
* @param rect damage area
|
1998-04-28 19:16:24 +00:00
|
|
|
* @param aPaintFlags see nsIView.h for flag definitions
|
1998-06-03 21:30:51 +00:00
|
|
|
* @return PR_TRUE if the entire clip region has been eliminated, else PR_FALSE
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsRect& rect,
|
1998-10-11 01:00:59 +00:00
|
|
|
PRUint32 aPaintFlags, PRBool &aResult) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to indicate that the specified region of the view
|
|
|
|
* needs to be drawn via the rendering context. The region
|
|
|
|
* is specified in view coordinates.
|
|
|
|
* @param rc rendering context to paint into
|
|
|
|
* @param region damage area
|
1998-04-28 19:16:24 +00:00
|
|
|
* @param aPaintFlags see nsIView.h for flag definitions
|
1998-06-03 21:30:51 +00:00
|
|
|
* @return PR_TRUE if the entire clip region has been eliminated, else PR_FALSE
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsIRegion& region,
|
|
|
|
PRUint32 aPaintFlags, PRBool &aResult) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Called to indicate that the specified event should be handled
|
|
|
|
* by the view. This method should return nsEventStatus_eConsumeDoDefault
|
|
|
|
* or nsEventStatus_eConsumeNoDefault if the event has been handled.
|
|
|
|
* @param event event to process
|
1998-04-28 19:16:24 +00:00
|
|
|
* @param aEventFlags see nsIView.h for flag definitions
|
1998-04-15 20:25:02 +00:00
|
|
|
* @result processing status
|
|
|
|
*/
|
massive landing of joki changes.
Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
2000-08-08 21:31:05 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsGUIEvent *event,
|
|
|
|
PRUint32 aEventFlags,
|
|
|
|
nsEventStatus* aStatus,
|
|
|
|
PRBool aForceHandle,
|
|
|
|
PRBool& aHandled) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Called to indicate that the position of the view has been changed.
|
|
|
|
* The specified coordinates are in the parent view's coordinate space.
|
|
|
|
* @param x new x position
|
|
|
|
* @param y new y position
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetPosition(nscoord x, nscoord y) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to get the position of a view.
|
|
|
|
* The specified coordinates are in the parent view's coordinate space.
|
|
|
|
* @param x out parameter for x position
|
|
|
|
* @param y out parameter for y position
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetPosition(nscoord *x, nscoord *y) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Called to indicate that the dimensions of the view (actually the
|
|
|
|
* width and height of the clip) have been changed.
|
|
|
|
* @param width new width
|
|
|
|
* @param height new height
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE) = 0;
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetDimensions(nscoord *width, nscoord *height) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Called to indicate that the dimensions and position of the view have
|
|
|
|
* been changed.
|
|
|
|
* @param aBounds new bounds
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetBounds(const nsRect &aBounds, PRBool aPaint = PR_TRUE) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to indicate that the dimensions and position of the view have
|
|
|
|
* been changed.
|
|
|
|
* @param aX new x position
|
|
|
|
* @param aY new y position
|
|
|
|
* @param aWidth new width
|
|
|
|
* @param aHeight new height
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetBounds(nscoord aX, nscoord aY,
|
|
|
|
nscoord aWidth, nscoord aHeight,
|
|
|
|
PRBool aPaint = PR_TRUE) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to get the dimensions and position of the view.
|
|
|
|
* @param aBounds out parameter for bounds
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD GetBounds(nsRect &aBounds) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
2000-04-13 21:56:27 +00:00
|
|
|
* Called to set the clip of the children of this view.
|
1998-04-15 20:25:02 +00:00
|
|
|
* The clip is relative to the origin of the view.
|
2000-04-13 21:56:27 +00:00
|
|
|
* All of the children of this view will be clipped using
|
|
|
|
* the specified rectangle
|
1998-04-28 19:16:24 +00:00
|
|
|
* @param aLeft new left position
|
|
|
|
* @param aTop new top position
|
|
|
|
* @param aRight new right position
|
|
|
|
* @param aBottom new bottom position
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
2000-04-13 21:56:27 +00:00
|
|
|
NS_IMETHOD SetChildClip(nscoord aLeft, nscoord aTop, nscoord aRight, nscoord aBottom) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to get the dimensions and position of the clip for the view.
|
1998-04-28 19:16:24 +00:00
|
|
|
* @param aLeft left position
|
|
|
|
* @param aTop top position
|
|
|
|
* @param aRight right position
|
|
|
|
* @param aBottom bottom position
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
2000-04-13 21:56:27 +00:00
|
|
|
NS_IMETHOD GetChildClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Called to indicate that the visibility of a view has been
|
|
|
|
* changed.
|
|
|
|
* @param visibility new visibility state
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetVisibility(nsViewVisibility aVisibility) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to query the visibility state of a view.
|
|
|
|
* @result current visibility state
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2000-08-12 19:05:52 +00:00
|
|
|
/**
|
|
|
|
* Called to set the Z-order parent of the view. This is the
|
|
|
|
* parent from which we derive our Z-order grouping. It might not
|
|
|
|
* be the same as the geometric parent.
|
|
|
|
* @param aParent new parent
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetZParent(nsIView *aZParent) = 0;
|
|
|
|
NS_IMETHOD GetZParent(nsIView *&aZParent) const = 0;
|
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Called to indicate that the z-index of a view has been changed.
|
|
|
|
* The z-index is relative to all siblings of the view.
|
|
|
|
* @param zindex new z depth
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetZIndex(PRInt32 aZIndex) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to query the z-index of a view.
|
|
|
|
* The z-index is relative to all siblings of the view.
|
|
|
|
* @result current z depth
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetZIndex(PRInt32 &aZIndex) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-09-23 23:26:54 +00:00
|
|
|
/**
|
|
|
|
* Indicate that the z-index of a view is "auto". An "auto" z-index
|
|
|
|
* means that the view does not define a new stacking context,
|
|
|
|
* which means that the z-indicies of the view's children are
|
|
|
|
* relative to the view's siblings.
|
|
|
|
* @param aAutoZIndex if true then z-index will be auto
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetAutoZIndex(PRBool aAutoZIndex) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if an auto z-index is set for this view.
|
|
|
|
* @result current state of auto z-indexing
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetAutoZIndex(PRBool &aAutoZIndex) const = 0;
|
|
|
|
|
2000-01-25 01:53:34 +00:00
|
|
|
/**
|
|
|
|
* Set/Get whether the view "floats" above all other views,
|
|
|
|
* which tells the compositor not to consider higher views in
|
|
|
|
* the view hierarchy that would geometrically intersect with
|
|
|
|
* this view. This is a hack, but it fixes some problems with
|
|
|
|
* views that need to be drawn in front of all other views.
|
|
|
|
* @result PR_TRUE if the view floats, PR_FALSE otherwise.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetFloating(PRBool aFloatingView) = 0;
|
|
|
|
NS_IMETHOD GetFloating(PRBool &aFloatingView) const = 0;
|
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
2000-08-12 19:05:52 +00:00
|
|
|
* Called to set the parent of the view. This is the geometric parent
|
|
|
|
* (from which we derive our coordinate system).
|
1998-04-15 20:25:02 +00:00
|
|
|
* @param aParent new parent
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetParent(nsIView *aParent) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to query the parent of the view.
|
|
|
|
* @result view's parent
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetParent(nsIView *&aParent) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Called to query the next sibling of the view.
|
|
|
|
* @result view's next sibling
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to set the next sibling of the view.
|
|
|
|
* @param aNextSibling new next sibling
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetNextSibling(nsIView* aNextSibling) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Used to insert a child after the specified sibling. In general,
|
|
|
|
* child insertion will happen through the view manager and it
|
|
|
|
* will determine the ordering of children in the child list.
|
|
|
|
* @param child to insert in this view's child list
|
1998-04-30 02:41:14 +00:00
|
|
|
* @param sibling view to set as previous sibling of child
|
|
|
|
* if nsnull, then child is inserted at head of list
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD InsertChild(nsIView *aChild, nsIView *aSibling) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Remove a child from the child list. The removal will be driven
|
|
|
|
* through the view manager.
|
|
|
|
* @param child to remove
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD RemoveChild(nsIView *aChild) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Get the number of children for this view.
|
|
|
|
* @result child count
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetChildCount(PRInt32 &aCount) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Get a child at a specific index. Could be replaced by some sort of
|
|
|
|
* enumeration API.
|
|
|
|
* @param index of desired child view
|
|
|
|
* @result the view at index or nsnull if there is no such child
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetChild(PRInt32 index, nsIView*& aChild) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
|
|
|
* A value of 0.0 means completely transparent. A value of 1.0 means
|
|
|
|
* completely opaque.
|
|
|
|
* @param opacity new opacity value
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetOpacity(float aOpacity) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
|
|
|
* A value of 0.0 means completely transparent. A value of 1.0 means
|
|
|
|
* completely opaque.
|
|
|
|
* @result view's opacity value
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetOpacity(float &aOpacity) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Used to ask a view if it has any areas within its bounding box
|
|
|
|
* that are transparent. This is not the same as opacity - opacity can
|
|
|
|
* be set externally, transparency is a quality of the view itself.
|
|
|
|
* @result Returns PR_TRUE if there are transparent areas, PR_FALSE otherwise.
|
|
|
|
*/
|
1998-10-11 01:00:59 +00:00
|
|
|
NS_IMETHOD HasTransparency(PRBool &aTransparent) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-06-03 22:49:45 +00:00
|
|
|
/**
|
|
|
|
* Used set the transparency status of the content in a view. see
|
|
|
|
* HasTransparency().
|
|
|
|
* @param aTransparent PR_TRUE if there are transparent areas, PR_FALSE otherwise.
|
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetContentTransparency(PRBool aTransparent) = 0;
|
1998-06-03 22:49:45 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
1998-08-28 03:05:23 +00:00
|
|
|
* Set the view's link to client owned data.
|
|
|
|
* @param aData - data to associate with view. nsnull to disassociate
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD SetClientData(void *aData) = 0;
|
1998-04-15 20:25:02 +00:00
|
|
|
|
|
|
|
/**
|
1998-08-28 03:05:23 +00:00
|
|
|
* Query the view for it's link to client owned data.
|
|
|
|
* @result data associated with view or nsnull if there is none.
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetClientData(void *&aData) const = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
1998-06-16 17:05:42 +00:00
|
|
|
* Get the nearest widget in this view or a parent of this view and
|
|
|
|
* the offset from the view that contains the widget to this view
|
|
|
|
* @param aDx out parameter for x offset
|
|
|
|
* @param aDy out parameter for y offset
|
|
|
|
* @return widget (if there is one) closest to view
|
1998-04-15 20:25:02 +00:00
|
|
|
*/
|
1998-08-30 19:16:11 +00:00
|
|
|
NS_IMETHOD GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget) = 0;
|
1998-06-16 17:05:42 +00:00
|
|
|
|
1998-10-15 04:55:21 +00:00
|
|
|
/**
|
|
|
|
* Gets the dirty region associated with this view. Used by the view
|
|
|
|
* manager.
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetDirtyRegion(nsIRegion *&aRegion) const = 0;
|
1998-10-15 04:55:21 +00:00
|
|
|
|
1998-11-04 04:14:10 +00:00
|
|
|
/**
|
|
|
|
* Create a widget to associate with this view. This is a helper
|
|
|
|
* function for SetWidget.
|
|
|
|
* @param aWindowIID IID for Widget type that this view
|
|
|
|
* should have associated with it. if nsull, then no
|
|
|
|
* width will be created for this view
|
|
|
|
* @param aWidgetInitData data used to initialize this view's widget before
|
|
|
|
* its create is called.
|
|
|
|
* @param aNative native window that will be used as parent of
|
|
|
|
* aWindowIID. if nsnull, then parent will be derived from
|
|
|
|
* parent view and it's ancestors
|
|
|
|
* @return error status
|
|
|
|
*/
|
|
|
|
NS_IMETHOD CreateWidget(const nsIID &aWindowIID,
|
|
|
|
nsWidgetInitData *aWidgetInitData = nsnull,
|
1999-08-26 14:41:18 +00:00
|
|
|
nsNativeWidget aNative = nsnull,
|
|
|
|
PRBool aEnableDragDrop = PR_TRUE) = 0;
|
1998-11-04 04:14:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the widget associated with this view.
|
|
|
|
* @param aWidget widget to associate with view. It is an error
|
|
|
|
* to associate a widget with more than one view. To disassociate
|
|
|
|
* a widget from a view, use nsnull. If there are no more references
|
|
|
|
* to the widget that may have been associated with the view, it will
|
|
|
|
* be destroyed.
|
|
|
|
* @return error status
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetWidget(nsIWidget *aWidget) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* In 4.0, the "cutout" nature of a view is queryable.
|
|
|
|
* If we believe that all cutout view have a native widget, this
|
|
|
|
* could be a replacement.
|
|
|
|
* @param aWidget out parameter for widget that this view contains,
|
1999-11-14 02:51:25 +00:00
|
|
|
* or nsnull if there is none.
|
1998-11-04 04:14:10 +00:00
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetWidget(nsIWidget *&aWidget) const = 0;
|
1998-11-04 04:14:10 +00:00
|
|
|
|
1999-11-14 02:51:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns PR_TRUE if the view has a widget associated with it.
|
|
|
|
* @param aHasWidget out parameter that indicates whether a view has a widget.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD HasWidget(PRBool *aHasWidget) const = 0;
|
|
|
|
|
1998-04-15 20:25:02 +00:00
|
|
|
/**
|
|
|
|
* Output debug info to FILE
|
|
|
|
* @param out output file handle
|
|
|
|
* @param aIndent indentation depth
|
|
|
|
*/
|
1999-11-14 02:51:25 +00:00
|
|
|
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
1998-08-08 04:23:33 +00:00
|
|
|
|
1999-02-01 22:45:59 +00:00
|
|
|
/**
|
|
|
|
* Set flags on view to allow customization of view behavior during
|
|
|
|
* event handling
|
|
|
|
* @param aFlags flags to be added to view
|
|
|
|
*/
|
1999-04-16 04:23:43 +00:00
|
|
|
NS_IMETHOD SetViewFlags(PRUint32 aFlags) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove flags from view to allow customization of view behavior during
|
|
|
|
* event handling
|
|
|
|
* @param aFlags flags to be removed from view
|
|
|
|
*/
|
|
|
|
NS_IMETHOD ClearViewFlags(PRUint32 aFlags) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get flags on view to allow customization of view behavior during
|
|
|
|
* event handling
|
|
|
|
* @param aFlags out parameter for view flags
|
|
|
|
*/
|
1999-04-23 17:44:48 +00:00
|
|
|
NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const = 0;
|
1999-02-01 22:45:59 +00:00
|
|
|
|
2000-02-02 00:58:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Used by the compositor for temporary marking of a view during
|
|
|
|
* compositing. This will eventually replace GetScratchPoint above.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SetCompositorFlags(PRUint32 aFlags) = 0;
|
|
|
|
NS_IMETHOD GetCompositorFlags(PRUint32 *aFlags) = 0;
|
1999-03-09 22:10:31 +00:00
|
|
|
|
1999-04-16 04:50:02 +00:00
|
|
|
/**
|
|
|
|
* Get the extents of the view tree from 'this' down.
|
|
|
|
* 'this' is the coordinate system origin.
|
|
|
|
* @param aExtents out paramemter for extents
|
|
|
|
* @return error status
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetExtents(nsRect *aExtents) = 0;
|
|
|
|
|
1999-12-14 22:21:58 +00:00
|
|
|
// XXX Temporary for Bug #19416
|
|
|
|
NS_IMETHOD IgnoreSetPosition(PRBool aShouldIgnore) = 0;
|
|
|
|
|
2000-04-03 03:55:38 +00:00
|
|
|
/**
|
|
|
|
* Sync your widget size and position with the view
|
|
|
|
*/
|
|
|
|
NS_IMETHOD SynchWidgetSizePosition() = 0;
|
|
|
|
|
2000-04-13 21:56:27 +00:00
|
|
|
/**
|
|
|
|
* Return a rectangle containing the view's bounds adjusted for it's ancestors clipping
|
|
|
|
* @param aClippedRect views bounds adjusted for ancestors clipping. If aEmpty is TRUE it
|
|
|
|
* aClippedRect is set to an empty rect.
|
|
|
|
* @param aIsClipped returns with PR_TRUE if view's rectangle is clipped by an ancestor
|
|
|
|
* @param aEmpty returns with PR_TRUE if view's rectangle is 'clipped out'
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetClippedRect(nsRect& aClippedRect, PRBool& aIsClipped, PRBool& aEmpty) const = 0;
|
|
|
|
|
2000-04-03 03:55:38 +00:00
|
|
|
|
1998-08-08 04:23:33 +00:00
|
|
|
private:
|
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
|
1998-04-13 20:24:54 +00:00
|
|
|
};
|
|
|
|
|
1998-04-28 19:16:24 +00:00
|
|
|
//this is passed down to child views during painting and event handling
|
|
|
|
//so that a child can determine if it is hidden or shown when it's
|
|
|
|
//visibility state is set to inherit
|
|
|
|
#define NS_VIEW_FLAG_PARENT_HIDDEN 0x0001
|
|
|
|
|
1998-05-27 02:13:28 +00:00
|
|
|
//when painting, if we have determined that we need to do a combination
|
|
|
|
//of front to back and back to front painting, this flag will be set
|
|
|
|
//while in the back to front pass
|
|
|
|
#define NS_VIEW_FLAG_BACK_TO_FRONT 0x0002
|
|
|
|
|
1998-04-28 19:16:24 +00:00
|
|
|
//during event propagation, see if parent views can handle the event
|
1998-05-27 02:13:28 +00:00
|
|
|
#define NS_VIEW_FLAG_CHECK_PARENT 0x0004
|
1998-04-28 19:16:24 +00:00
|
|
|
|
|
|
|
//during event propagation, see if child views can handle the event
|
1998-05-27 02:13:28 +00:00
|
|
|
#define NS_VIEW_FLAG_CHECK_CHILDREN 0x0008
|
1998-04-28 19:16:24 +00:00
|
|
|
|
1998-05-29 22:44:13 +00:00
|
|
|
//during event propagation, see if sibling views can handle the event
|
|
|
|
#define NS_VIEW_FLAG_CHECK_SIBLINGS 0x0010
|
|
|
|
|
1998-06-16 17:05:42 +00:00
|
|
|
//passed down through the class hierarchy
|
|
|
|
//to indicate that the clip is set by an
|
|
|
|
//outer class
|
|
|
|
#define NS_VIEW_FLAG_CLIP_SET 0x0020
|
|
|
|
|
1998-10-11 01:00:59 +00:00
|
|
|
//when painting, if we have determined that we need to do a combination
|
|
|
|
//of front to back and back to front painting, this flag will be set
|
|
|
|
//while in the front to back pass
|
|
|
|
#define NS_VIEW_FLAG_FRONT_TO_BACK 0x0040
|
|
|
|
|
1999-02-03 04:12:21 +00:00
|
|
|
//temporary hack so that michael can work on the new
|
|
|
|
//compositor and make checkins without busting the rest
|
|
|
|
//of the world.
|
|
|
|
#define NS_VIEW_FLAG_JUST_PAINT 0x0080
|
|
|
|
|
1999-04-16 04:23:43 +00:00
|
|
|
//the following are public flags accessed through the *ViewFlags methods.
|
|
|
|
|
1999-02-01 22:45:59 +00:00
|
|
|
//Flag to determine whether the view will check if events can be handled
|
|
|
|
//by its children or just handle the events itself
|
1999-04-16 04:23:43 +00:00
|
|
|
#define NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN 0x0001
|
|
|
|
//the view is dying.
|
|
|
|
#define NS_VIEW_PUBLIC_FLAG_DYING 0x0002
|
|
|
|
//the view is transparent
|
|
|
|
#define NS_VIEW_PUBLIC_FLAG_TRANSPARENT 0x0004
|
|
|
|
//indicates that a view should not zoom values to/from widgets
|
|
|
|
#define NS_VIEW_PUBLIC_FLAG_DONT_ZOOM 0x0008
|
1999-04-21 21:22:22 +00:00
|
|
|
//indicates that the view should not be bitblt'd when moved
|
|
|
|
//or scrolled and instead must be repainted
|
1999-04-21 21:08:27 +00:00
|
|
|
#define NS_VIEW_PUBLIC_FLAG_DONT_BITBLT 0x0010
|
1999-09-23 23:26:54 +00:00
|
|
|
// indicates that the view is using auto z-indexing
|
|
|
|
#define NS_VIEW_PUBLIC_FLAG_AUTO_ZINDEX 0x0020
|
2000-01-25 01:53:34 +00:00
|
|
|
// indicatest hat the view is a floating view.
|
|
|
|
#define NS_VIEW_PUBLIC_FLAG_FLOATING 0x0040
|
2000-04-13 21:56:27 +00:00
|
|
|
|
2000-04-03 03:55:38 +00:00
|
|
|
// set if our widget resized.
|
|
|
|
#define NS_VIEW_PUBLIC_FLAG_WIDGET_RESIZED 0x0080
|
|
|
|
// set if our widget moved.
|
|
|
|
#define NS_VIEW_PUBLIC_FLAG_WIDGET_MOVED 0x0100
|
1999-04-16 04:23:43 +00:00
|
|
|
|
2000-04-13 21:56:27 +00:00
|
|
|
// indicates that the view should clip its child views using ClipRect specified
|
|
|
|
// by SetClip
|
|
|
|
#define NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN 0x0200
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
#endif
|