mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Changes nsIView and nsIScrollableView interfaces to conform to
XPCOM conventions
This commit is contained in:
parent
f65058fecc
commit
ad9a20da0b
@ -1570,9 +1570,10 @@ HTMLContentSink::StartLayout()
|
||||
nsIScrollableView* sview = nsnull;
|
||||
rootView->QueryInterface(kIScrollableViewIID, (void**) &sview);
|
||||
if (nsnull != sview) {
|
||||
mOriginalScrollPreference = (topLevelFrameset)
|
||||
? nsScrollPreference_kNeverScroll
|
||||
: sview->GetScrollPreference();
|
||||
if (topLevelFrameset)
|
||||
mOriginalScrollPreference = nsScrollPreference_kNeverScroll;
|
||||
else
|
||||
sview->GetScrollPreference(mOriginalScrollPreference);
|
||||
sview->SetScrollPreference(nsScrollPreference_kNeverScroll);
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,8 @@ NS_IMETHODIMP DeviceContextImpl :: GetDevUnitsToAppUnits(float &aDevUnits) const
|
||||
NS_IMETHODIMP DeviceContextImpl :: CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext)
|
||||
{
|
||||
nsIRenderingContext *pContext;
|
||||
nsIWidget *win = aView->GetWidget();
|
||||
nsIWidget *win;
|
||||
aView->GetWidget(win);
|
||||
nsresult rv;
|
||||
|
||||
static NS_DEFINE_IID(kRCCID, NS_RENDERING_CONTEXT_CID);
|
||||
|
@ -50,9 +50,6 @@
|
||||
#define kInsertInRemoveList 0
|
||||
#define kInsertInAddList 1
|
||||
|
||||
|
||||
NS_DEF_PTR(nsIViewManager);
|
||||
|
||||
// Kludged Content stuff
|
||||
nsIFrame * fFrameArray[1024];
|
||||
nsIContent * fContentArray[1024];
|
||||
@ -397,7 +394,8 @@ NS_METHOD nsFrame::MoveTo(nscoord aX, nscoord aY)
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
GetOffsetFromView(origin, parentWithView);
|
||||
nsIViewManager *vm = mView->GetViewManager();
|
||||
nsIViewManager *vm;
|
||||
mView->GetViewManager(vm);
|
||||
vm->MoveViewTo(mView, origin.x, origin.y);
|
||||
NS_RELEASE(vm);
|
||||
}
|
||||
@ -412,7 +410,8 @@ NS_METHOD nsFrame::SizeTo(nscoord aWidth, nscoord aHeight)
|
||||
|
||||
// Let the view know
|
||||
if ((nsnull != mView) && (0 == (mState & NS_FRAME_IN_REFLOW))) {
|
||||
nsIViewManager *vm = mView->GetViewManager();
|
||||
nsIViewManager *vm;
|
||||
mView->GetViewManager(vm);
|
||||
vm->ResizeView(mView, aWidth, aHeight);
|
||||
NS_RELEASE(vm);
|
||||
}
|
||||
@ -1076,7 +1075,8 @@ nsFrame::DidReflow(nsIPresContext& aPresContext,
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
GetOffsetFromView(origin, parentWithView);
|
||||
nsIViewManager *vm = mView->GetViewManager();
|
||||
nsIViewManager *vm;
|
||||
mView->GetViewManager(vm);
|
||||
vm->ResizeView(mView, mRect.width, mRect.height);
|
||||
vm->MoveViewTo(mView, origin.x, origin.y);
|
||||
NS_RELEASE(vm);
|
||||
@ -1303,7 +1303,7 @@ NS_METHOD nsFrame::GetWindow(nsIWidget*& aWindow) const
|
||||
|
||||
frame->GetView(view);
|
||||
if (nsnull != view) {
|
||||
aWindow = view->GetWidget();
|
||||
view->GetWidget(aWindow);
|
||||
if (nsnull != aWindow) {
|
||||
break;
|
||||
}
|
||||
@ -1316,10 +1316,10 @@ NS_METHOD nsFrame::GetWindow(nsIWidget*& aWindow) const
|
||||
|
||||
void nsFrame::Invalidate(const nsRect& aDamageRect) const
|
||||
{
|
||||
nsIViewManagerPtr viewManager;
|
||||
nsIViewManager* viewManager = nsnull;
|
||||
|
||||
if (nsnull != mView) {
|
||||
viewManager = mView->GetViewManager();
|
||||
mView->GetViewManager(viewManager);
|
||||
viewManager->UpdateView(mView, aDamageRect, NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
} else {
|
||||
@ -1330,9 +1330,11 @@ void nsFrame::Invalidate(const nsRect& aDamageRect) const
|
||||
GetOffsetFromView(offset, view);
|
||||
NS_ASSERTION(nsnull != view, "no view");
|
||||
rect += offset;
|
||||
viewManager = view->GetViewManager();
|
||||
view->GetViewManager(viewManager);
|
||||
viewManager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(viewManager);
|
||||
}
|
||||
|
||||
// Style sizing methods
|
||||
@ -1703,10 +1705,9 @@ void ForceDrawFrame(nsFrame * aFrame)//, PRBool)
|
||||
aFrame->GetRect(rect);
|
||||
rect.x = pnt.x;
|
||||
rect.y = pnt.y;
|
||||
// XXX I sure hope this code isn't actually used, because the ref counting is
|
||||
// all screwed up...
|
||||
if (view != nsnull) {
|
||||
nsIViewManager * viewMgr = view->GetViewManager();
|
||||
nsIViewManager * viewMgr;
|
||||
view->GetViewManager(viewMgr);
|
||||
if (viewMgr != nsnull) {
|
||||
viewMgr->UpdateView(view, rect, 0);
|
||||
NS_RELEASE(viewMgr);
|
||||
|
@ -318,7 +318,8 @@ nsFrameImageLoader::DamageRepairFrame(const nsRect* aDamageRect)
|
||||
// itself. Add some API calls to nsIFrame to allow a caller to invalidate
|
||||
// parts of the frame...
|
||||
mTargetFrame->GetOffsetFromView(offset, view);
|
||||
nsIViewManager* vm = view->GetViewManager();
|
||||
nsIViewManager* vm;
|
||||
view->GetViewManager(vm);
|
||||
bounds.x += offset.x;
|
||||
bounds.y += offset.y;
|
||||
// XXX At least for the time being don't allow a synchronous repaint, because
|
||||
|
@ -821,12 +821,14 @@ NS_IMETHODIMP PresShell :: Paint(nsIView *aView,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
nsIFrame *frame;
|
||||
nsresult rv;
|
||||
void* clientData;
|
||||
nsIFrame* frame;
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION(!(nsnull == aView), "null view");
|
||||
|
||||
frame = (nsIFrame *)aView->GetClientData();
|
||||
aView->GetClientData(clientData);
|
||||
frame = (nsIFrame *)clientData;
|
||||
|
||||
if (nsnull != frame)
|
||||
rv = frame->Paint(*mPresContext, aRenderingContext, aDirtyRect);
|
||||
@ -840,12 +842,14 @@ NS_IMETHODIMP PresShell :: HandleEvent(nsIView *aView,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus& aEventStatus)
|
||||
{
|
||||
nsIFrame *frame;
|
||||
void* clientData;
|
||||
nsIFrame* frame;
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION(!(nsnull == aView), "null view");
|
||||
|
||||
frame = (nsIFrame *)aView->GetClientData();
|
||||
aView->GetClientData(clientData);
|
||||
frame = (nsIFrame *)clientData;
|
||||
|
||||
if (nsnull != frame)
|
||||
rv = frame->HandleEvent(*mPresContext, aEvent, aEventStatus);
|
||||
@ -857,12 +861,14 @@ NS_IMETHODIMP PresShell :: HandleEvent(nsIView *aView,
|
||||
|
||||
NS_IMETHODIMP PresShell :: Scrolled(nsIView *aView)
|
||||
{
|
||||
nsIFrame *frame;
|
||||
void* clientData;
|
||||
nsIFrame* frame;
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION(!(nsnull == aView), "null view");
|
||||
|
||||
frame = (nsIFrame *)aView->GetClientData();
|
||||
aView->GetClientData(clientData);
|
||||
frame = (nsIFrame *)clientData;
|
||||
|
||||
if (nsnull != frame)
|
||||
{
|
||||
@ -949,8 +955,8 @@ CompareTrees(nsIFrame* aA, nsIFrame* aB)
|
||||
v2->GetBounds(r2);
|
||||
NS_ASSERTION(r1 == r2, "child views are different sizes");
|
||||
|
||||
w1 = v1->GetWidget();
|
||||
w2 = v2->GetWidget();
|
||||
v1->GetWidget(w1);
|
||||
v2->GetWidget(w2);
|
||||
if (nsnull != w1) {
|
||||
NS_ASSERTION(nsnull != w2, "child widgets are not matched");
|
||||
w1->GetBounds(r1);
|
||||
@ -1083,9 +1089,10 @@ PresShell::VerifyIncrementalReflow()
|
||||
nsIScrollableView* scrollView;
|
||||
rv = rootView->QueryInterface(kScrollViewIID, (void**)&scrollView);
|
||||
if (NS_OK == rv) {
|
||||
scrolling = scrollView->GetScrollPreference();
|
||||
scrollView->GetScrollPreference(scrolling);
|
||||
}
|
||||
nsIWidget* rootWidget = rootView->GetWidget();
|
||||
nsIWidget* rootWidget;
|
||||
rootView->GetWidget(rootWidget);
|
||||
void* nativeParentWidget = rootWidget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
|
||||
// Create a new view manager.
|
||||
|
@ -270,7 +270,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
||||
|
||||
GetView(view);
|
||||
|
||||
widget = view->GetWidget();
|
||||
view->GetWidget(widget);
|
||||
widget->GetBounds(wrect);
|
||||
|
||||
nsAutoString src, base, fullurl;
|
||||
|
@ -821,7 +821,8 @@ nsIView* nsBodyFrame::CreateAbsoluteView(const nsStylePosition* aPosition,
|
||||
}
|
||||
|
||||
// Initialize the view
|
||||
nsIViewManager* viewManager = containingView->GetViewManager();
|
||||
nsIViewManager* viewManager;
|
||||
containingView->GetViewManager(viewManager);
|
||||
NS_ASSERTION(nsnull != viewManager, "null view manager");
|
||||
|
||||
// Is there a clip rect specified?
|
||||
|
@ -99,7 +99,8 @@ nsHTMLBase::CreateViewForFrame(nsIPresContext* aPresContext,
|
||||
(void **)&view);
|
||||
if (NS_OK == result) {
|
||||
nsIView* rootView = parView;
|
||||
nsIViewManager* viewManager = rootView->GetViewManager();
|
||||
nsIViewManager* viewManager;
|
||||
rootView->GetViewManager(viewManager);
|
||||
|
||||
// Initialize the view
|
||||
NS_ASSERTION(nsnull != viewManager, "null view manager");
|
||||
|
@ -894,7 +894,8 @@ ImageFrame::ContentChanged(nsIPresShell* aShell,
|
||||
nsPoint offset;
|
||||
nsIView* view;
|
||||
GetOffsetFromView(offset, view);
|
||||
nsIViewManager* vm = view->GetViewManager();
|
||||
nsIViewManager* vm;
|
||||
view->GetViewManager(vm);
|
||||
bounds.x = offset.x;
|
||||
bounds.y = offset.y;
|
||||
bounds.width = mRect.width;
|
||||
|
@ -270,7 +270,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext,
|
||||
|
||||
GetView(view);
|
||||
|
||||
widget = view->GetWidget();
|
||||
view->GetWidget(widget);
|
||||
widget->GetBounds(wrect);
|
||||
|
||||
nsAutoString src, base, fullurl;
|
||||
|
@ -228,7 +228,8 @@ RootContentFrame::RootContentFrame(nsIContent* aContent, nsIFrame* aParent)
|
||||
(void **)&view);
|
||||
if (NS_OK == result) {
|
||||
nsIView* rootView = parView;
|
||||
nsIViewManager* viewManager = rootView->GetViewManager();
|
||||
nsIViewManager* viewManager;
|
||||
rootView->GetViewManager(viewManager);
|
||||
|
||||
// Initialize the view
|
||||
NS_ASSERTION(nsnull != viewManager, "null view manager");
|
||||
|
@ -348,7 +348,8 @@ nsScrollInnerFrame::Reflow(nsIPresContext& aPresContext,
|
||||
parent->GetView(parentView);
|
||||
NS_ASSERTION(parentView, "GetParentWithView failed");
|
||||
|
||||
nsIViewManager* viewManager = parentView->GetViewManager();
|
||||
nsIViewManager* viewManager;
|
||||
parentView->GetViewManager(viewManager);
|
||||
|
||||
nsresult rv = NSRepository::CreateInstance(kScrollingViewCID,
|
||||
nsnull,
|
||||
|
@ -423,7 +423,8 @@ void TextTimer::Notify(nsITimer *timer)
|
||||
text->GetRect(bounds);
|
||||
nsIView* view;
|
||||
text->GetOffsetFromView(offset, view);
|
||||
nsIViewManager* vm = view->GetViewManager();
|
||||
nsIViewManager* vm;
|
||||
view->GetViewManager(vm);
|
||||
bounds.x = offset.x;
|
||||
bounds.y = offset.y;
|
||||
vm->UpdateView(view, bounds, 0);
|
||||
|
@ -1570,9 +1570,10 @@ HTMLContentSink::StartLayout()
|
||||
nsIScrollableView* sview = nsnull;
|
||||
rootView->QueryInterface(kIScrollableViewIID, (void**) &sview);
|
||||
if (nsnull != sview) {
|
||||
mOriginalScrollPreference = (topLevelFrameset)
|
||||
? nsScrollPreference_kNeverScroll
|
||||
: sview->GetScrollPreference();
|
||||
if (topLevelFrameset)
|
||||
mOriginalScrollPreference = nsScrollPreference_kNeverScroll;
|
||||
else
|
||||
sview->GetScrollPreference(mOriginalScrollPreference);
|
||||
sview->SetScrollPreference(nsScrollPreference_kNeverScroll);
|
||||
}
|
||||
}
|
||||
|
@ -546,7 +546,8 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
|
||||
NS_RELEASE(viewMan);
|
||||
SetView(view);
|
||||
|
||||
nsIWidget* widget = view->GetWidget();
|
||||
nsIWidget* widget;
|
||||
view->GetWidget(widget);
|
||||
nsRect webBounds(0, 0, NSToCoordRound(aSize.width * t2p),
|
||||
NSToCoordRound(aSize.height * t2p));
|
||||
|
||||
|
@ -53,10 +53,11 @@ GetWindowTemp(nsIView *aView)
|
||||
|
||||
nsIView *ancestor = aView;
|
||||
while (nsnull != ancestor) {
|
||||
if (nsnull != (window = ancestor->GetWidget())) {
|
||||
ancestor->GetWidget(window);
|
||||
if (nsnull != window) {
|
||||
return window;
|
||||
}
|
||||
ancestor = ancestor->GetParent();
|
||||
ancestor->GetParent(ancestor);
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
@ -78,7 +79,9 @@ void nsInputFileFrame::MouseClicked(nsIPresContext* aPresContext)
|
||||
if (NS_OK != textFrame->GetWidget(textView, (nsIWidget **)&textWidget)) {
|
||||
return;
|
||||
}
|
||||
nsIWidget* parentWidget = GetWindowTemp(textView->GetParent());
|
||||
nsIView* parentView;
|
||||
textView->GetParent(parentView);
|
||||
nsIWidget* parentWidget = GetWindowTemp(parentView);
|
||||
|
||||
nsIFileWidget *fileWidget;
|
||||
|
||||
|
@ -154,7 +154,9 @@ nsInputFrame::SetViewVisiblity(nsIPresContext* aPresContext, PRBool aShow)
|
||||
// initially the widget was created as hidden
|
||||
nsViewVisibility newVisibility =
|
||||
aShow ? nsViewVisibility_kShow : nsViewVisibility_kHide;
|
||||
if (newVisibility != view->GetVisibility()) {
|
||||
nsViewVisibility currentVisibility;
|
||||
view->GetVisibility(currentVisibility);
|
||||
if (newVisibility != currentVisibility) {
|
||||
// this only inits the 1st time
|
||||
// XXX kipp says: this is yucky; init on first visibility seems lame
|
||||
// XXX is this even called
|
||||
@ -339,7 +341,8 @@ nsInputFrame::PostCreateWidget(nsIPresContext* aPresContext, nsIView *aView)
|
||||
nsresult
|
||||
nsInputFrame::GetWidget(nsIView* aView, nsIWidget** aWidget)
|
||||
{
|
||||
nsIWidget* widget = aView->GetWidget();
|
||||
nsIWidget* widget;
|
||||
aView->GetWidget(widget);
|
||||
nsresult result;
|
||||
|
||||
if (nsnull == widget) {
|
||||
|
@ -349,7 +349,8 @@ nsSelectFrame::PostCreateWidget(nsIPresContext* aPresContext, nsIView *aView)
|
||||
nsIView* view;
|
||||
GetView(view);
|
||||
|
||||
nsIWidget* widget = view->GetWidget();
|
||||
nsIWidget* widget;
|
||||
view->GetWidget(widget);
|
||||
nsIListWidget* list;
|
||||
if ((nsnull == widget) || NS_FAILED(widget->QueryInterface(kListWidgetIID, (void **) &list))) {
|
||||
NS_ASSERTION(PR_FALSE, "invalid widget");
|
||||
|
@ -42,14 +42,14 @@ public:
|
||||
/**
|
||||
* Compute the size of the scrolled contanier.
|
||||
*/
|
||||
virtual void ComputeContainerSize(void) = 0;
|
||||
NS_IMETHOD ComputeContainerSize(void) = 0;
|
||||
|
||||
/**
|
||||
* Get the dimensions of the container
|
||||
* @param aWidth return value for width of container
|
||||
* @param aHeight return value for height of container
|
||||
*/
|
||||
virtual void GetContainerSize(nscoord *aWidth, nscoord *aHeight) = 0;
|
||||
NS_IMETHOD GetContainerSize(nscoord *aWidth, nscoord *aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Set the offset into the container of the
|
||||
@ -57,53 +57,53 @@ public:
|
||||
* @param aOffsetX X offset in twips
|
||||
* @param aOffsetY Y offset in twips
|
||||
*/
|
||||
virtual void SetVisibleOffset(nscoord aOffsetX, nscoord aOffsetY) = 0;
|
||||
NS_IMETHOD SetVisibleOffset(nscoord aOffsetX, nscoord aOffsetY) = 0;
|
||||
|
||||
/**
|
||||
* Get the offset of the top/left most visible coordinate
|
||||
* @param aOffsetX return value for X coordinate in twips
|
||||
* @param aOffsetY return value for Y coordinate in twips
|
||||
*/
|
||||
virtual void GetVisibleOffset(nscoord *aOffsetX, nscoord *aOffsetY) = 0;
|
||||
NS_IMETHOD GetVisibleOffset(nscoord *aOffsetX, nscoord *aOffsetY) = 0;
|
||||
|
||||
/**
|
||||
* Get the view that we are scrolling within the
|
||||
* scrolling view.
|
||||
* @result child view
|
||||
*/
|
||||
virtual nsIView * GetScrolledView(void) = 0;
|
||||
NS_IMETHOD GetScrolledView(nsIView *&aScrolledView) = 0;
|
||||
|
||||
/**
|
||||
* Select whether quality level should be displayed in view frame
|
||||
* @param aShow if PR_TRUE, quality level will be displayed, else hidden
|
||||
*/
|
||||
virtual void ShowQuality(PRBool aShow) = 0;
|
||||
NS_IMETHOD ShowQuality(PRBool aShow) = 0;
|
||||
|
||||
/**
|
||||
* Query whether quality level should be displayed in view frame
|
||||
* @return if PR_TRUE, quality level will be displayed, else hidden
|
||||
*/
|
||||
virtual PRBool GetShowQuality(void) = 0;
|
||||
NS_IMETHOD GetShowQuality(PRBool &aShow) = 0;
|
||||
|
||||
/**
|
||||
* Select whether quality level should be displayed in view frame
|
||||
* @param aShow if PR_TRUE, quality level will be displayed, else hidden
|
||||
*/
|
||||
virtual void SetQuality(nsContentQuality aQuality) = 0;
|
||||
NS_IMETHOD SetQuality(nsContentQuality aQuality) = 0;
|
||||
|
||||
/**
|
||||
* Select whether scroll bars should be displayed all the time, never or
|
||||
* only when necessary.
|
||||
* @param aPref desired scrollbar selection
|
||||
*/
|
||||
virtual void SetScrollPreference(nsScrollPreference aPref) = 0;
|
||||
NS_IMETHOD SetScrollPreference(nsScrollPreference aPref) = 0;
|
||||
|
||||
/**
|
||||
* Query whether scroll bars should be displayed all the time, never or
|
||||
* only when necessary.
|
||||
* @return current scrollbar selection
|
||||
*/
|
||||
virtual nsScrollPreference GetScrollPreference(void) = 0;
|
||||
NS_IMETHOD GetScrollPreference(nsScrollPreference& aScrollPreference) = 0;
|
||||
|
||||
/**
|
||||
* Scroll the view to the given x,y, update's the scrollbar's thumb
|
||||
|
@ -95,16 +95,16 @@ public:
|
||||
* @param aVisibilityFlag initial visibility state of view
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
virtual nsresult Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsIID *aWindowIID = nsnull,
|
||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||
nsNativeWidget aNative = nsnull,
|
||||
PRInt32 aZIndex = 0,
|
||||
const nsViewClip *aClip = nsnull,
|
||||
float aOpacity = 1.0f,
|
||||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow) = 0;
|
||||
NS_IMETHOD Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsIID *aWindowIID = nsnull,
|
||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||
nsNativeWidget aNative = nsnull,
|
||||
PRInt32 aZIndex = 0,
|
||||
const nsViewClip *aClip = nsnull,
|
||||
float aOpacity = 1.0f,
|
||||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow) = 0;
|
||||
|
||||
/**
|
||||
* Destroy the view.
|
||||
@ -116,13 +116,13 @@ public:
|
||||
* SetRootView(NULL) if the view is the root view and calling RemoveChild()
|
||||
* otherwise.
|
||||
*/
|
||||
virtual void Destroy() = 0;
|
||||
NS_IMETHOD Destroy() = 0;
|
||||
|
||||
/**
|
||||
* Get the view manager the "owns" the view
|
||||
* @result view manager
|
||||
*/
|
||||
virtual nsIViewManager * GetViewManager() = 0;
|
||||
NS_IMETHOD GetViewManager(nsIViewManager *&aViewMgr) = 0;
|
||||
|
||||
/**
|
||||
* In 4.0, the "cutout" nature of a view is queryable.
|
||||
@ -130,7 +130,7 @@ public:
|
||||
* could be a replacement.
|
||||
* @result widget that this view contains
|
||||
*/
|
||||
virtual nsIWidget * GetWidget() = 0;
|
||||
NS_IMETHOD GetWidget(nsIWidget *&aWidget) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the specified rect of the view
|
||||
@ -141,11 +141,11 @@ public:
|
||||
* @param aPaintFlags see nsIView.h for flag definitions
|
||||
* @param aBackstop if we will need to do back to front
|
||||
* painting, this is the view that, once rendered
|
||||
* ends the back to front pass.
|
||||
* ends the back to front pass. can be nsnull.
|
||||
* @return PR_TRUE if the entire clip region has been eliminated, else PR_FALSE
|
||||
*/
|
||||
virtual PRBool Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop = nsnull) = 0;
|
||||
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop, PRBool &aResult) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the specified region of the view
|
||||
@ -156,7 +156,8 @@ public:
|
||||
* @param aPaintFlags see nsIView.h for flag definitions
|
||||
* @return PR_TRUE if the entire clip region has been eliminated, else PR_FALSE
|
||||
*/
|
||||
virtual PRBool Paint(nsIRenderingContext& rc, const nsIRegion& region, PRUint32 aPaintFlags) = 0;
|
||||
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsIRegion& region,
|
||||
PRUint32 aPaintFlags, PRBool &aResult) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the specified event should be handled
|
||||
@ -166,7 +167,7 @@ public:
|
||||
* @param aEventFlags see nsIView.h for flag definitions
|
||||
* @result processing status
|
||||
*/
|
||||
virtual nsEventStatus HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags) = 0;
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, nsEventStatus &aStatus) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the position of the view has been changed.
|
||||
@ -174,7 +175,7 @@ public:
|
||||
* @param x new x position
|
||||
* @param y new y position
|
||||
*/
|
||||
virtual void SetPosition(nscoord x, nscoord y) = 0;
|
||||
NS_IMETHOD SetPosition(nscoord x, nscoord y) = 0;
|
||||
|
||||
/**
|
||||
* Called to get the position of a view.
|
||||
@ -182,7 +183,7 @@ public:
|
||||
* @param x out parameter for x position
|
||||
* @param y out parameter for y position
|
||||
*/
|
||||
virtual void GetPosition(nscoord *x, nscoord *y) = 0;
|
||||
NS_IMETHOD GetPosition(nscoord *x, nscoord *y) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the dimensions of the view (actually the
|
||||
@ -190,15 +191,15 @@ public:
|
||||
* @param width new width
|
||||
* @param height new height
|
||||
*/
|
||||
virtual void SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE) = 0;
|
||||
virtual void GetDimensions(nscoord *width, nscoord *height) = 0;
|
||||
NS_IMETHOD SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE) = 0;
|
||||
NS_IMETHOD GetDimensions(nscoord *width, nscoord *height) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the dimensions and position of the view have
|
||||
* been changed.
|
||||
* @param aBounds new bounds
|
||||
*/
|
||||
virtual void SetBounds(const nsRect &aBounds, PRBool aPaint = PR_TRUE) = 0;
|
||||
NS_IMETHOD SetBounds(const nsRect &aBounds, PRBool aPaint = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the dimensions and position of the view have
|
||||
@ -208,15 +209,15 @@ public:
|
||||
* @param aWidth new width
|
||||
* @param aHeight new height
|
||||
*/
|
||||
virtual void SetBounds(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aPaint = PR_TRUE) = 0;
|
||||
NS_IMETHOD SetBounds(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aPaint = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Called to get the dimensions and position of the view.
|
||||
* @param aBounds out parameter for bounds
|
||||
*/
|
||||
virtual void GetBounds(nsRect &aBounds) const = 0;
|
||||
NS_IMETHOD GetBounds(nsRect &aBounds) const = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the clip of the view has been changed.
|
||||
@ -226,7 +227,7 @@ public:
|
||||
* @param aRight new right position
|
||||
* @param aBottom new bottom position
|
||||
*/
|
||||
virtual void SetClip(nscoord aLeft, nscoord aTop, nscoord aRight, nscoord aBottom) = 0;
|
||||
NS_IMETHOD SetClip(nscoord aLeft, nscoord aTop, nscoord aRight, nscoord aBottom) = 0;
|
||||
|
||||
/**
|
||||
* Called to get the dimensions and position of the clip for the view.
|
||||
@ -236,58 +237,59 @@ public:
|
||||
* @param aBottom bottom position
|
||||
* @result PR_TRUE of there actually is a clip for the view, else PR_FALSE
|
||||
*/
|
||||
virtual PRBool GetClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom) = 0;
|
||||
NS_IMETHOD GetClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom,
|
||||
PRBool &aResult) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the visibility of a view has been
|
||||
* changed.
|
||||
* @param visibility new visibility state
|
||||
*/
|
||||
virtual void SetVisibility(nsViewVisibility visibility) = 0;
|
||||
NS_IMETHOD SetVisibility(nsViewVisibility aVisibility) = 0;
|
||||
|
||||
/**
|
||||
* Called to query the visibility state of a view.
|
||||
* @result current visibility state
|
||||
*/
|
||||
virtual nsViewVisibility GetVisibility() = 0;
|
||||
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility) = 0;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
virtual void SetZIndex(PRInt32 zindex) = 0;
|
||||
NS_IMETHOD SetZIndex(PRInt32 aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Called to query the z-index of a view.
|
||||
* The z-index is relative to all siblings of the view.
|
||||
* @result current z depth
|
||||
*/
|
||||
virtual PRInt32 GetZIndex() = 0;
|
||||
NS_IMETHOD GetZIndex(PRInt32 &aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Called to set the parent of the view.
|
||||
* @param aParent new parent
|
||||
*/
|
||||
virtual void SetParent(nsIView *aParent) = 0;
|
||||
NS_IMETHOD SetParent(nsIView *aParent) = 0;
|
||||
|
||||
/**
|
||||
* Called to query the parent of the view.
|
||||
* @result view's parent
|
||||
*/
|
||||
virtual nsIView *GetParent() = 0;
|
||||
NS_IMETHOD GetParent(nsIView *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Called to query the next sibling of the view.
|
||||
* @result view's next sibling
|
||||
*/
|
||||
virtual nsIView* GetNextSibling() const = 0;
|
||||
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const = 0;
|
||||
|
||||
/**
|
||||
* Called to set the next sibling of the view.
|
||||
* @param aNextSibling new next sibling
|
||||
*/
|
||||
virtual void SetNextSibling(nsIView* aNextSibling) = 0;
|
||||
NS_IMETHOD SetNextSibling(nsIView* aNextSibling) = 0;
|
||||
|
||||
/**
|
||||
* Used to insert a child after the specified sibling. In general,
|
||||
@ -297,20 +299,20 @@ public:
|
||||
* @param sibling view to set as previous sibling of child
|
||||
* if nsnull, then child is inserted at head of list
|
||||
*/
|
||||
virtual void InsertChild(nsIView *child, nsIView *sibling) = 0;
|
||||
NS_IMETHOD InsertChild(nsIView *aChild, nsIView *aSibling) = 0;
|
||||
|
||||
/**
|
||||
* Remove a child from the child list. The removal will be driven
|
||||
* through the view manager.
|
||||
* @param child to remove
|
||||
*/
|
||||
virtual void RemoveChild(nsIView *child) = 0;
|
||||
NS_IMETHOD RemoveChild(nsIView *aChild) = 0;
|
||||
|
||||
/**
|
||||
* Get the number of children for this view.
|
||||
* @result child count
|
||||
*/
|
||||
virtual PRInt32 GetChildCount() = 0;
|
||||
NS_IMETHOD GetChildCount(PRInt32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Get a child at a specific index. Could be replaced by some sort of
|
||||
@ -318,21 +320,21 @@ public:
|
||||
* @param index of desired child view
|
||||
* @result the view at index or nsnull if there is no such child
|
||||
*/
|
||||
virtual nsIView * GetChild(PRInt32 index) = 0;
|
||||
NS_IMETHOD GetChild(PRInt32 index, nsIView*& aChild) = 0;
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. This transform might include scaling
|
||||
* but probably not rotation for the first pass.
|
||||
* @param transform new transformation of view
|
||||
*/
|
||||
virtual void SetTransform(nsTransform2D &aXForm) = 0;
|
||||
NS_IMETHOD SetTransform(nsTransform2D &aXForm) = 0;
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. This transform might include scaling
|
||||
* but probably not rotation for the first pass.
|
||||
* @result view's transformation
|
||||
*/
|
||||
virtual void GetTransform(nsTransform2D &aXForm) = 0;
|
||||
NS_IMETHOD GetTransform(nsTransform2D &aXForm) = 0;
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
||||
@ -340,7 +342,7 @@ public:
|
||||
* completely opaque.
|
||||
* @param opacity new opacity value
|
||||
*/
|
||||
virtual void SetOpacity(float opacity) = 0;
|
||||
NS_IMETHOD SetOpacity(float aOpacity) = 0;
|
||||
|
||||
/**
|
||||
* Note: This didn't exist in 4.0. Called to set the opacity of a view.
|
||||
@ -348,7 +350,7 @@ public:
|
||||
* completely opaque.
|
||||
* @result view's opacity value
|
||||
*/
|
||||
virtual float GetOpacity() = 0;
|
||||
NS_IMETHOD GetOpacity(float &aOpacity) = 0;
|
||||
|
||||
/**
|
||||
* Used to ask a view if it has any areas within its bounding box
|
||||
@ -356,26 +358,26 @@ public:
|
||||
* be set externally, transparency is a quality of the view itself.
|
||||
* @result Returns PR_TRUE if there are transparent areas, PR_FALSE otherwise.
|
||||
*/
|
||||
virtual PRBool HasTransparency() = 0;
|
||||
NS_IMETHOD HasTransparency(PRBool &aTransparent) = 0;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
virtual void SetContentTransparency(PRBool aTransparent) = 0;
|
||||
NS_IMETHOD SetContentTransparency(PRBool aTransparent) = 0;
|
||||
|
||||
/**
|
||||
* Set the view's link to client owned data.
|
||||
* @param aData - data to associate with view. nsnull to disassociate
|
||||
*/
|
||||
virtual void SetClientData(void *aData) = 0;
|
||||
NS_IMETHOD SetClientData(void *aData) = 0;
|
||||
|
||||
/**
|
||||
* Query the view for it's link to client owned data.
|
||||
* @result data associated with view or nsnull if there is none.
|
||||
*/
|
||||
virtual void * GetClientData() = 0;
|
||||
NS_IMETHOD GetClientData(void *&aData) = 0;
|
||||
|
||||
/**
|
||||
* Get the nearest widget in this view or a parent of this view and
|
||||
@ -384,14 +386,14 @@ public:
|
||||
* @param aDy out parameter for y offset
|
||||
* @return widget (if there is one) closest to view
|
||||
*/
|
||||
virtual nsIWidget * GetOffsetFromWidget(nscoord *aDx, nscoord *aDy) = 0;
|
||||
NS_IMETHOD GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget) = 0;
|
||||
|
||||
/**
|
||||
* Get the visible offset of scrollable view (if any) that contains this view
|
||||
* @param aDx out parameter for x offset
|
||||
* @param aDy out parameter for y offset
|
||||
*/
|
||||
virtual void GetScrollOffset(nscoord *aDx, nscoord *aDy) = 0;
|
||||
NS_IMETHOD GetScrollOffset(nscoord *aDx, nscoord *aDy) = 0;
|
||||
|
||||
/**
|
||||
* Output debug info to FILE
|
||||
|
@ -29,6 +29,15 @@
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
static inline PRBool
|
||||
ViewIsShowing(nsIView *aView)
|
||||
{
|
||||
nsViewVisibility visibility;
|
||||
|
||||
aView->GetVisibility(visibility);
|
||||
return nsViewVisibility_kShow == visibility;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIScrollbarIID, NS_ISCROLLBAR_IID);
|
||||
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
|
||||
static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID);
|
||||
@ -38,9 +47,9 @@ class ScrollBarView : public nsView
|
||||
public:
|
||||
ScrollBarView(nsScrollingView *aScrollingView);
|
||||
~ScrollBarView();
|
||||
nsEventStatus HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||
void SetPosition(nscoord x, nscoord y);
|
||||
void SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags, nsEventStatus &aStatus);
|
||||
NS_IMETHOD SetPosition(nscoord x, nscoord y);
|
||||
NS_IMETHOD SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
|
||||
public:
|
||||
nsScrollingView *mScrollingView;
|
||||
@ -55,9 +64,10 @@ ScrollBarView :: ~ScrollBarView()
|
||||
{
|
||||
}
|
||||
|
||||
nsEventStatus ScrollBarView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags)
|
||||
NS_IMETHODIMP ScrollBarView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags,
|
||||
nsEventStatus &aStatus)
|
||||
{
|
||||
nsEventStatus retval = nsEventStatus_eIgnore;
|
||||
aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
switch (aEvent->message)
|
||||
{
|
||||
@ -69,17 +79,17 @@ nsEventStatus ScrollBarView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFl
|
||||
NS_ASSERTION((nsnull != mScrollingView), "HandleEvent() called after the ScrollingView has been destroyed.");
|
||||
if (nsnull != mScrollingView)
|
||||
mScrollingView->HandleScrollEvent(aEvent, aEventFlags);
|
||||
retval = nsEventStatus_eConsumeNoDefault;
|
||||
aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void ScrollBarView :: SetPosition(nscoord x, nscoord y)
|
||||
NS_IMETHODIMP ScrollBarView :: SetPosition(nscoord x, nscoord y)
|
||||
{
|
||||
mBounds.MoveTo(x, y);
|
||||
|
||||
@ -93,7 +103,7 @@ void ScrollBarView :: SetPosition(nscoord x, nscoord y)
|
||||
mViewManager->GetDeviceContext(dx);
|
||||
dx->GetAppUnitsToDevUnits(twipToPix);
|
||||
|
||||
pwidget = GetOffsetFromWidget(&parx, &pary);
|
||||
GetOffsetFromWidget(&parx, &pary, pwidget);
|
||||
NS_IF_RELEASE(pwidget);
|
||||
|
||||
mWindow->Move(NSTwipsToIntPixels((x + parx), twipToPix),
|
||||
@ -101,9 +111,10 @@ void ScrollBarView :: SetPosition(nscoord x, nscoord y)
|
||||
|
||||
NS_RELEASE(dx);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void ScrollBarView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
NS_IMETHODIMP ScrollBarView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
{
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
@ -120,6 +131,7 @@ void ScrollBarView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint
|
||||
|
||||
NS_RELEASE(dx);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -139,11 +151,12 @@ class CornerView : public nsView
|
||||
public:
|
||||
CornerView();
|
||||
~CornerView();
|
||||
void ShowQuality(PRBool aShow);
|
||||
void SetQuality(nsContentQuality aQuality);
|
||||
void Show(PRBool aShow);
|
||||
PRBool Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop = nsnull);
|
||||
NS_IMETHOD ShowQuality(PRBool aShow);
|
||||
NS_IMETHOD SetQuality(nsContentQuality aQuality);
|
||||
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop, PRBool &Result);
|
||||
|
||||
void Show(PRBool aShow);
|
||||
|
||||
PRBool mShowQuality;
|
||||
nsContentQuality mQuality;
|
||||
@ -161,7 +174,7 @@ CornerView :: ~CornerView()
|
||||
{
|
||||
}
|
||||
|
||||
void CornerView :: ShowQuality(PRBool aShow)
|
||||
NS_IMETHODIMP CornerView :: ShowQuality(PRBool aShow)
|
||||
{
|
||||
if (mShowQuality != aShow)
|
||||
{
|
||||
@ -184,9 +197,10 @@ void CornerView :: ShowQuality(PRBool aShow)
|
||||
|
||||
mViewManager->UpdateView(this, nsnull, NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void CornerView :: SetQuality(nsContentQuality aQuality)
|
||||
NS_IMETHODIMP CornerView :: SetQuality(nsContentQuality aQuality)
|
||||
{
|
||||
if (mQuality != aQuality)
|
||||
{
|
||||
@ -195,6 +209,7 @@ void CornerView :: SetQuality(nsContentQuality aQuality)
|
||||
if (mVis == nsViewVisibility_kShow)
|
||||
mViewManager->UpdateView(this, nsnull, NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void CornerView :: Show(PRBool aShow)
|
||||
@ -221,8 +236,8 @@ void CornerView :: Show(PRBool aShow)
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
PRBool CornerView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop)
|
||||
NS_IMETHODIMP CornerView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop, PRBool &aResult)
|
||||
{
|
||||
PRBool clipres = PR_FALSE;
|
||||
|
||||
@ -317,7 +332,8 @@ PRBool CornerView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
}
|
||||
}
|
||||
|
||||
return clipres;
|
||||
aResult = clipres;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
|
||||
@ -382,16 +398,16 @@ nsrefcnt nsScrollingView :: Release()
|
||||
return 1;
|
||||
}
|
||||
|
||||
nsresult nsScrollingView :: Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsIID *aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsNativeWidget aNative,
|
||||
PRInt32 aZIndex,
|
||||
const nsViewClip *aClip,
|
||||
float aOpacity,
|
||||
nsViewVisibility aVisibilityFlag)
|
||||
NS_IMETHODIMP nsScrollingView :: Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsIID *aWindowIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsNativeWidget aNative,
|
||||
PRInt32 aZIndex,
|
||||
const nsViewClip *aClip,
|
||||
float aOpacity,
|
||||
nsViewVisibility aVisibilityFlag)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -473,7 +489,7 @@ nsresult nsScrollingView :: Init(nsIViewManager* aManager,
|
||||
return rv;
|
||||
}
|
||||
|
||||
void nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
NS_IMETHODIMP nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
{
|
||||
nsRect trect;
|
||||
nsIDeviceContext *dx;
|
||||
@ -494,10 +510,10 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPai
|
||||
mCornerView->SetBounds(trect, aPaint);
|
||||
}
|
||||
|
||||
if (mHScrollBarView && (mHScrollBarView->GetVisibility() == nsViewVisibility_kShow))
|
||||
if (mHScrollBarView && ViewIsShowing(mHScrollBarView))
|
||||
showHorz = scrollHeight;
|
||||
|
||||
if (mVScrollBarView && (mVScrollBarView->GetVisibility() == nsViewVisibility_kShow))
|
||||
if (mVScrollBarView && ViewIsShowing(mVScrollBarView))
|
||||
showVert = scrollWidth;
|
||||
|
||||
// nsView :: SetDimensions(width, height, aPaint);
|
||||
@ -529,7 +545,8 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPai
|
||||
|
||||
trect.height = height;
|
||||
|
||||
if (showHorz || (mCornerView && (mCornerView->GetVisibility() == nsViewVisibility_kShow)))
|
||||
//if (showHorz || (mCornerView && (mCornerView->GetVisibility() == nsViewVisibility_kShow)))
|
||||
if (showHorz)
|
||||
trect.height -= scrollHeight;
|
||||
|
||||
trect.x = width - scrollWidth;
|
||||
@ -544,7 +561,8 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPai
|
||||
|
||||
trect.width = width;
|
||||
|
||||
if (showVert || (mCornerView && (mCornerView->GetVisibility() == nsViewVisibility_kShow)))
|
||||
//if (showVert || (mCornerView && (mCornerView->GetVisibility() == nsViewVisibility_kShow)))
|
||||
if (showVert)
|
||||
trect.width -= scrollWidth;
|
||||
|
||||
trect.y = height - scrollHeight;
|
||||
@ -560,16 +578,18 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPai
|
||||
// ComputeContainerSize();
|
||||
|
||||
NS_RELEASE(dx);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: SetPosition(nscoord aX, nscoord aY)
|
||||
NS_IMETHODIMP nsScrollingView :: SetPosition(nscoord aX, nscoord aY)
|
||||
{
|
||||
nsIDeviceContext *dx;
|
||||
nsIWidget *thiswin = GetWidget();
|
||||
nsIWidget *thiswin;
|
||||
GetWidget(thiswin);
|
||||
float t2p;
|
||||
|
||||
if (nsnull == thiswin)
|
||||
thiswin = GetOffsetFromWidget(nsnull, nsnull);
|
||||
GetOffsetFromWidget(nsnull, nsnull, thiswin);
|
||||
|
||||
if (nsnull != thiswin)
|
||||
thiswin->BeginResizingChildren();
|
||||
@ -588,10 +608,12 @@ void nsScrollingView :: SetPosition(nscoord aX, nscoord aY)
|
||||
}
|
||||
|
||||
NS_RELEASE(dx);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsScrollingView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop)
|
||||
NS_IMETHODIMP nsScrollingView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop,
|
||||
PRBool &aResult)
|
||||
{
|
||||
PRBool clipres = PR_FALSE;
|
||||
nsRect brect;
|
||||
@ -606,7 +628,7 @@ PRBool nsScrollingView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
if (clipres == PR_FALSE)
|
||||
{
|
||||
rc.Translate(-mOffsetX, -mOffsetY);
|
||||
clipres = nsView::Paint(rc, rect, aPaintFlags | NS_VIEW_FLAG_CLIP_SET, aBackstop);
|
||||
nsView::Paint(rc, rect, aPaintFlags | NS_VIEW_FLAG_CLIP_SET, aBackstop, clipres);
|
||||
}
|
||||
|
||||
clipres = rc.PopState();
|
||||
@ -614,7 +636,8 @@ PRBool nsScrollingView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
if ((clipres == PR_FALSE) && (mVis == nsViewVisibility_kShow) && (nsnull == mWindow))
|
||||
clipres = rc.SetClipRect(brect, nsClipCombine_kSubtract);
|
||||
|
||||
return clipres;
|
||||
aResult = clipres;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags)
|
||||
@ -658,17 +681,18 @@ void nsScrollingView :: HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFla
|
||||
|
||||
mVScrollBarView->GetDimensions(&sx, &sy);
|
||||
|
||||
if ((nsnull != mHScrollBarView) && (mHScrollBarView->GetVisibility() == nsViewVisibility_kShow))
|
||||
if ((nsnull != mHScrollBarView) && ViewIsShowing(mHScrollBarView))
|
||||
mHScrollBarView->GetDimensions(&sx, &sy);
|
||||
else
|
||||
sy = 0;
|
||||
|
||||
mViewManager->ClearDirtyRegion();
|
||||
|
||||
nsIWidget *thiswin = GetWidget();
|
||||
nsIWidget *thiswin;
|
||||
GetWidget(thiswin);
|
||||
|
||||
if (nsnull == thiswin)
|
||||
thiswin = GetOffsetFromWidget(nsnull, nsnull);
|
||||
GetOffsetFromWidget(nsnull, nsnull, thiswin);
|
||||
|
||||
if (nsnull != thiswin)
|
||||
thiswin->BeginResizingChildren();
|
||||
@ -721,7 +745,7 @@ void nsScrollingView :: HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFla
|
||||
{
|
||||
nscoord sx, sy;
|
||||
|
||||
if ((nsnull != mVScrollBarView) && (mVScrollBarView->GetVisibility() == nsViewVisibility_kShow))
|
||||
if ((nsnull != mVScrollBarView) && ViewIsShowing(mVScrollBarView))
|
||||
mVScrollBarView->GetDimensions(&sx, &sy);
|
||||
else
|
||||
sx = 0;
|
||||
@ -730,10 +754,11 @@ void nsScrollingView :: HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFla
|
||||
|
||||
mViewManager->ClearDirtyRegion();
|
||||
|
||||
nsIWidget *thiswin = GetWidget();
|
||||
nsIWidget *thiswin;
|
||||
GetWidget(thiswin);
|
||||
|
||||
if (nsnull == thiswin)
|
||||
thiswin = GetOffsetFromWidget(nsnull, nsnull);
|
||||
GetOffsetFromWidget(nsnull, nsnull, thiswin);
|
||||
|
||||
if (nsnull != thiswin)
|
||||
thiswin->BeginResizingChildren();
|
||||
@ -767,7 +792,8 @@ void nsScrollingView :: HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFla
|
||||
void nsScrollingView :: Notify(nsITimer * aTimer)
|
||||
{
|
||||
nscoord xoff, yoff;
|
||||
nsIView *view = GetScrolledView();
|
||||
nsIView *view;
|
||||
GetScrolledView(view);
|
||||
|
||||
// First do the scrolling of the view
|
||||
|
||||
@ -809,7 +835,8 @@ void nsScrollingView :: Notify(nsITimer * aTimer)
|
||||
mScrollingTimer->Init(this, 25);
|
||||
}
|
||||
|
||||
nsEventStatus nsScrollingView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags)
|
||||
NS_IMETHODIMP nsScrollingView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags,
|
||||
nsEventStatus &aStatus)
|
||||
{
|
||||
switch (aEvent->message)
|
||||
{
|
||||
@ -817,7 +844,8 @@ nsEventStatus nsScrollingView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEvent
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
{
|
||||
nsIWidget *win = GetWidget();
|
||||
nsIWidget *win;
|
||||
GetWidget(win);
|
||||
|
||||
if (nsnull != win)
|
||||
{
|
||||
@ -835,7 +863,8 @@ nsEventStatus nsScrollingView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEvent
|
||||
case NS_VK_PAGE_DOWN :
|
||||
case NS_VK_PAGE_UP : {
|
||||
nsIScrollbar *scrollv = nsnull, *scrollh = nsnull;
|
||||
nsIWidget *win = mVScrollBarView->GetWidget();
|
||||
nsIWidget *win;
|
||||
mVScrollBarView->GetWidget(win);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kIScrollbarIID, (void **)&scrollv))
|
||||
{
|
||||
@ -857,7 +886,8 @@ nsEventStatus nsScrollingView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEvent
|
||||
case NS_VK_DOWN :
|
||||
case NS_VK_UP : {
|
||||
nsIScrollbar *scrollv = nsnull, *scrollh = nsnull;
|
||||
nsIWidget *win = mVScrollBarView->GetWidget();
|
||||
nsIWidget *win;
|
||||
mVScrollBarView->GetWidget(win);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kIScrollbarIID, (void **)&scrollv))
|
||||
{
|
||||
@ -971,12 +1001,13 @@ nsEventStatus nsScrollingView :: HandleEvent(nsGUIEvent *aEvent, PRUint32 aEvent
|
||||
break;
|
||||
}
|
||||
|
||||
return nsView::HandleEvent(aEvent, aEventFlags);
|
||||
return nsView::HandleEvent(aEvent, aEventFlags, aStatus);
|
||||
}
|
||||
|
||||
void nsScrollingView :: ComputeContainerSize()
|
||||
NS_IMETHODIMP nsScrollingView :: ComputeContainerSize()
|
||||
{
|
||||
nsIView *scrollview = GetScrolledView();
|
||||
nsIView *scrollview;
|
||||
GetScrolledView(scrollview);
|
||||
nsIScrollbar *scrollv = nsnull, *scrollh = nsnull;
|
||||
nsIWidget *win;
|
||||
|
||||
@ -1002,7 +1033,7 @@ void nsScrollingView :: ComputeContainerSize()
|
||||
if (nsnull != mHScrollBarView)
|
||||
{
|
||||
mHScrollBarView->GetDimensions(&hwidth, &hheight);
|
||||
win = mHScrollBarView->GetWidget();
|
||||
mHScrollBarView->GetWidget(win);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kIScrollbarIID, (void **)&scrollh))
|
||||
{
|
||||
@ -1022,7 +1053,7 @@ void nsScrollingView :: ComputeContainerSize()
|
||||
mVScrollBarView->GetDimensions(&vwidth, &vheight);
|
||||
offy = mOffsetY;
|
||||
|
||||
win = mVScrollBarView->GetWidget();
|
||||
mVScrollBarView->GetWidget(win);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kIScrollbarIID, (void **)&scrollv))
|
||||
{
|
||||
@ -1077,7 +1108,7 @@ void nsScrollingView :: ComputeContainerSize()
|
||||
{
|
||||
offx = mOffsetX;
|
||||
|
||||
win = mHScrollBarView->GetWidget();
|
||||
mHScrollBarView->GetWidget(win);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kIScrollbarIID, (void **)&scrollh))
|
||||
{
|
||||
@ -1132,8 +1163,8 @@ void nsScrollingView :: ComputeContainerSize()
|
||||
|
||||
if (mCornerView)
|
||||
{
|
||||
if ((mHScrollBarView && (mHScrollBarView->GetVisibility() == nsViewVisibility_kShow)) &&
|
||||
(mVScrollBarView && (mVScrollBarView->GetVisibility() == nsViewVisibility_kShow)))
|
||||
if (mHScrollBarView && ViewIsShowing(mHScrollBarView) &&
|
||||
mVScrollBarView && ViewIsShowing(mVScrollBarView))
|
||||
((CornerView *)mCornerView)->Show(PR_TRUE);
|
||||
else
|
||||
((CornerView *)mCornerView)->Show(PR_FALSE);
|
||||
@ -1154,7 +1185,7 @@ void nsScrollingView :: ComputeContainerSize()
|
||||
{
|
||||
mHScrollBarView->SetVisibility(nsViewVisibility_kHide);
|
||||
|
||||
win = mHScrollBarView->GetWidget();
|
||||
mHScrollBarView->GetWidget(win);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kIScrollbarIID, (void **)&scrollh))
|
||||
{
|
||||
@ -1169,7 +1200,7 @@ void nsScrollingView :: ComputeContainerSize()
|
||||
{
|
||||
mVScrollBarView->SetVisibility(nsViewVisibility_kHide);
|
||||
|
||||
win = mVScrollBarView->GetWidget();
|
||||
mVScrollBarView->GetWidget(win);
|
||||
|
||||
if (NS_OK == win->QueryInterface(kIScrollbarIID, (void **)&scrollv))
|
||||
{
|
||||
@ -1186,50 +1217,59 @@ void nsScrollingView :: ComputeContainerSize()
|
||||
mOffsetX = mOffsetY = 0;
|
||||
mSizeX = mSizeY = 0;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: GetContainerSize(nscoord *aWidth, nscoord *aHeight)
|
||||
NS_IMETHODIMP nsScrollingView :: GetContainerSize(nscoord *aWidth, nscoord *aHeight)
|
||||
{
|
||||
*aWidth = mSizeX;
|
||||
*aHeight = mSizeY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: SetVisibleOffset(nscoord aOffsetX, nscoord aOffsetY)
|
||||
NS_IMETHODIMP nsScrollingView :: SetVisibleOffset(nscoord aOffsetX, nscoord aOffsetY)
|
||||
{
|
||||
mOffsetX = aOffsetX;
|
||||
mOffsetY = aOffsetY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: GetVisibleOffset(nscoord *aOffsetX, nscoord *aOffsetY)
|
||||
NS_IMETHODIMP nsScrollingView :: GetVisibleOffset(nscoord *aOffsetX, nscoord *aOffsetY)
|
||||
{
|
||||
*aOffsetX = mOffsetX;
|
||||
*aOffsetY = mOffsetY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: ShowQuality(PRBool aShow)
|
||||
NS_IMETHODIMP nsScrollingView :: ShowQuality(PRBool aShow)
|
||||
{
|
||||
((CornerView *)mCornerView)->ShowQuality(aShow);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsScrollingView :: GetShowQuality(void)
|
||||
NS_IMETHODIMP nsScrollingView :: GetShowQuality(PRBool &aShow)
|
||||
{
|
||||
return ((CornerView *)mCornerView)->mShowQuality;
|
||||
aShow = ((CornerView *)mCornerView)->mShowQuality;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: SetQuality(nsContentQuality aQuality)
|
||||
NS_IMETHODIMP nsScrollingView :: SetQuality(nsContentQuality aQuality)
|
||||
{
|
||||
((CornerView *)mCornerView)->SetQuality(aQuality);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: SetScrollPreference(nsScrollPreference aPref)
|
||||
NS_IMETHODIMP nsScrollingView :: SetScrollPreference(nsScrollPreference aPref)
|
||||
{
|
||||
mScrollPref = aPref;
|
||||
ComputeContainerSize();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsScrollPreference nsScrollingView :: GetScrollPreference(void)
|
||||
NS_IMETHODIMP nsScrollingView :: GetScrollPreference(nsScrollPreference &aScrollPreference)
|
||||
{
|
||||
return mScrollPref;
|
||||
aScrollPreference = mScrollPref;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX This doesn't do X scrolling yet
|
||||
@ -1253,7 +1293,7 @@ nsScrollingView :: ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags)
|
||||
NS_RELEASE(dx);
|
||||
|
||||
nsIWidget* win;
|
||||
win = mVScrollBarView->GetWidget();
|
||||
mVScrollBarView->GetWidget(win);
|
||||
if (nsnull != win)
|
||||
{
|
||||
nsIScrollbar* scrollv;
|
||||
@ -1288,7 +1328,8 @@ nsScrollingView :: ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags)
|
||||
// Damage the updated area
|
||||
r.x = 0;
|
||||
r.y = aY;
|
||||
nsIView* scrolledView = GetScrolledView();
|
||||
nsIView* scrolledView;
|
||||
GetScrolledView(scrolledView);
|
||||
if (nsnull != scrolledView)
|
||||
{
|
||||
mViewManager->UpdateView(scrolledView, r, aUpdateFlags);
|
||||
@ -1311,19 +1352,23 @@ NS_IMETHODIMP nsScrollingView :: GetClipSize(nscoord *aX, nscoord *aY)
|
||||
|
||||
void nsScrollingView :: AdjustChildWidgets(nsScrollingView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float scale)
|
||||
{
|
||||
PRInt32 numkids = aView->GetChildCount();
|
||||
PRInt32 numkids;
|
||||
aView->GetChildCount(numkids);
|
||||
nsIScrollableView *scroller;
|
||||
nscoord offx, offy;
|
||||
PRBool isscroll = PR_FALSE;
|
||||
|
||||
if (aScrolling == aView)
|
||||
{
|
||||
nsIWidget *widget = aScrolling->GetOffsetFromWidget(&aDx, &aDy);
|
||||
nsIView *parview = aScrolling->GetParent();
|
||||
nsIWidget *widget;
|
||||
aScrolling->GetOffsetFromWidget(&aDx, &aDy, widget);
|
||||
nsIView *parview;
|
||||
aScrolling->GetParent(parview);
|
||||
|
||||
while (nsnull != parview)
|
||||
{
|
||||
nsIWidget *parwidget = parview->GetWidget();
|
||||
nsIWidget *parwidget;
|
||||
parview->GetWidget(parwidget);
|
||||
|
||||
if (NS_OK == parview->QueryInterface(kIScrollableViewIID, (void **)&scroller))
|
||||
{
|
||||
@ -1341,7 +1386,7 @@ void nsScrollingView :: AdjustChildWidgets(nsScrollingView *aScrolling, nsIView
|
||||
|
||||
NS_IF_RELEASE(parwidget);
|
||||
|
||||
parview = parview->GetParent();
|
||||
parview->GetParent(parview);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(widget);
|
||||
@ -1364,8 +1409,10 @@ void nsScrollingView :: AdjustChildWidgets(nsScrollingView *aScrolling, nsIView
|
||||
|
||||
for (PRInt32 cnt = 0; cnt < numkids; cnt++)
|
||||
{
|
||||
nsIView *kid = aView->GetChild(cnt);
|
||||
nsIWidget *win = kid->GetWidget();
|
||||
nsIView *kid;
|
||||
aView->GetChild(cnt, kid);
|
||||
nsIWidget *win;
|
||||
kid->GetWidget(win);
|
||||
|
||||
if (nsnull != win)
|
||||
{
|
||||
@ -1393,26 +1440,26 @@ void nsScrollingView :: AdjustChildWidgets(nsScrollingView *aScrolling, nsIView
|
||||
}
|
||||
}
|
||||
|
||||
nsIView * nsScrollingView :: GetScrolledView(void)
|
||||
NS_IMETHODIMP nsScrollingView :: GetScrolledView(nsIView *&aScrolledView)
|
||||
{
|
||||
PRInt32 numkids;
|
||||
nsIView *retview = nsnull;
|
||||
|
||||
numkids = GetChildCount();
|
||||
aScrolledView = nsnull;
|
||||
GetChildCount(numkids);
|
||||
|
||||
for (PRInt32 cnt = 0; cnt < numkids; cnt++)
|
||||
{
|
||||
retview = GetChild(cnt);
|
||||
GetChild(cnt, aScrolledView);
|
||||
|
||||
if ((retview != mVScrollBarView) &&
|
||||
(retview != mHScrollBarView) &&
|
||||
(retview != mCornerView))
|
||||
if ((aScrolledView != mVScrollBarView) &&
|
||||
(aScrolledView != mHScrollBarView) &&
|
||||
(aScrolledView != mCornerView))
|
||||
break;
|
||||
else
|
||||
retview = nsnull;
|
||||
aScrolledView = nsnull;
|
||||
}
|
||||
|
||||
return retview;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsScrollingView :: ComputeScrollArea(nsIView *aView, nsRect &aRect,
|
||||
@ -1435,11 +1482,13 @@ void nsScrollingView :: ComputeScrollArea(nsIView *aView, nsRect &aRect,
|
||||
else
|
||||
aRect.UnionRect(aRect, trect);
|
||||
|
||||
PRInt32 numkids = aView->GetChildCount();
|
||||
PRInt32 numkids;
|
||||
aView->GetChildCount(numkids);
|
||||
|
||||
for (PRInt32 cnt = 0; cnt < numkids; cnt++)
|
||||
{
|
||||
nsIView *view = aView->GetChild(cnt);
|
||||
nsIView *view;
|
||||
aView->GetChild(cnt, view);
|
||||
ComputeScrollArea(view, aRect, aOffX, aOffY);
|
||||
}
|
||||
}
|
||||
|
@ -35,44 +35,44 @@ public:
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr);
|
||||
|
||||
virtual nsresult Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsIID *aWindowIID = nsnull,
|
||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||
nsNativeWidget aNative = nsnull,
|
||||
PRInt32 aZIndex = 0,
|
||||
const nsViewClip *aClip = nsnull,
|
||||
float aOpacity = 1.0f,
|
||||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
|
||||
NS_IMETHOD Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsIID *aWindowIID = nsnull,
|
||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||
nsNativeWidget aNative = nsnull,
|
||||
PRInt32 aZIndex = 0,
|
||||
const nsViewClip *aClip = nsnull,
|
||||
float aOpacity = 1.0f,
|
||||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
|
||||
|
||||
//overrides
|
||||
virtual void SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
virtual void SetPosition(nscoord aX, nscoord aY);
|
||||
virtual void HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||
virtual nsEventStatus HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||
virtual void AdjustChildWidgets(nsScrollingView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float aScale);
|
||||
virtual PRBool Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop = nsnull);
|
||||
NS_IMETHOD SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
NS_IMETHOD SetPosition(nscoord aX, nscoord aY);
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags, nsEventStatus &aStatus);
|
||||
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop, PRBool &aResult);
|
||||
|
||||
//nsIScrollableView interface
|
||||
virtual void ComputeContainerSize();
|
||||
virtual void GetContainerSize(nscoord *aWidth, nscoord *aHeight);
|
||||
virtual void SetVisibleOffset(nscoord aOffsetX, nscoord aOffsetY);
|
||||
virtual void GetVisibleOffset(nscoord *aOffsetX, nscoord *aOffsetY);
|
||||
virtual nsIView * GetScrolledView(void);
|
||||
NS_IMETHOD ComputeContainerSize();
|
||||
NS_IMETHOD GetContainerSize(nscoord *aWidth, nscoord *aHeight);
|
||||
NS_IMETHOD SetVisibleOffset(nscoord aOffsetX, nscoord aOffsetY);
|
||||
NS_IMETHOD GetVisibleOffset(nscoord *aOffsetX, nscoord *aOffsetY);
|
||||
NS_IMETHOD GetScrolledView(nsIView *&aScrolledView);
|
||||
|
||||
virtual void ShowQuality(PRBool aShow);
|
||||
virtual PRBool GetShowQuality(void);
|
||||
virtual void SetQuality(nsContentQuality aQuality);
|
||||
NS_IMETHOD ShowQuality(PRBool aShow);
|
||||
NS_IMETHOD GetShowQuality(PRBool &aShow);
|
||||
NS_IMETHOD SetQuality(nsContentQuality aQuality);
|
||||
|
||||
virtual void SetScrollPreference(nsScrollPreference aPref);
|
||||
virtual nsScrollPreference GetScrollPreference(void);
|
||||
NS_IMETHOD ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD GetClipSize(nscoord *aX, nscoord *aY);
|
||||
NS_IMETHOD SetScrollPreference(nsScrollPreference aPref);
|
||||
NS_IMETHOD GetScrollPreference(nsScrollPreference &aScrollPreference);
|
||||
NS_IMETHOD ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags);
|
||||
NS_IMETHOD GetClipSize(nscoord *aX, nscoord *aY);
|
||||
|
||||
//private
|
||||
void ComputeScrollArea(nsIView *aView, nsRect &aRect, nscoord aOffX, nscoord aOffY);
|
||||
virtual void HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||
virtual void AdjustChildWidgets(nsScrollingView *aScrolling, nsIView *aView, nscoord aDx, nscoord aDy, float aScale);
|
||||
|
||||
private:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
|
@ -48,7 +48,9 @@ nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent)
|
||||
|
||||
nsIView* view = nsView::GetViewFor(aEvent->widget);
|
||||
if (nsnull != view) {
|
||||
nsIViewManager* vm = view->GetViewManager();
|
||||
nsIViewManager* vm;
|
||||
|
||||
view->GetViewManager(vm);
|
||||
vm->DispatchEvent(aEvent, result);
|
||||
NS_RELEASE(vm);
|
||||
}
|
||||
@ -67,14 +69,18 @@ nsView :: ~nsView()
|
||||
{
|
||||
mVFlags |= VIEW_FLAG_DYING;
|
||||
|
||||
if (GetChildCount() > 0)
|
||||
PRInt32 numKids;
|
||||
GetChildCount(numKids);
|
||||
if (numKids > 0)
|
||||
{
|
||||
nsIView *kid;
|
||||
|
||||
//nuke the kids
|
||||
|
||||
while (kid = GetChild(0))
|
||||
kid->Destroy();
|
||||
do {
|
||||
GetChild(0, kid);
|
||||
if (nsnull != kid)
|
||||
kid->Destroy();
|
||||
} while (nsnull != kid);
|
||||
}
|
||||
|
||||
if (mXForm != nsnull)
|
||||
@ -173,16 +179,16 @@ nsIView* nsView::GetViewFor(nsIWidget* aWidget)
|
||||
return view;
|
||||
}
|
||||
|
||||
nsresult nsView :: Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsCID *aWindowCIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsNativeWidget aNative,
|
||||
PRInt32 aZIndex,
|
||||
const nsViewClip *aClip,
|
||||
float aOpacity,
|
||||
nsViewVisibility aVisibilityFlag)
|
||||
NS_IMETHODIMP nsView :: Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsCID *aWindowCIID,
|
||||
nsWidgetInitData *aWidgetInitData,
|
||||
nsNativeWidget aNative,
|
||||
PRInt32 aZIndex,
|
||||
const nsViewClip *aClip,
|
||||
float aOpacity,
|
||||
nsViewVisibility aVisibilityFlag)
|
||||
{
|
||||
//printf(" \n callback=%d data=%d", aWidgetCreateCallback, aCallbackData);
|
||||
NS_PRECONDITION(nsnull != aManager, "null ptr");
|
||||
@ -231,7 +237,8 @@ nsresult nsView :: Init(nsIViewManager* aManager,
|
||||
mWindow->Create(aNative, trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
else
|
||||
{
|
||||
nsIWidget *parent = GetOffsetFromWidget(nsnull, nsnull);
|
||||
nsIWidget *parent;
|
||||
GetOffsetFromWidget(nsnull, nsnull, parent);
|
||||
mWindow->Create(parent, trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
NS_IF_RELEASE(parent);
|
||||
}
|
||||
@ -245,25 +252,28 @@ nsresult nsView :: Init(nsIViewManager* aManager,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: Destroy()
|
||||
NS_IMETHODIMP nsView :: Destroy()
|
||||
{
|
||||
delete this;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIViewManager * nsView :: GetViewManager()
|
||||
NS_IMETHODIMP nsView :: GetViewManager(nsIViewManager *&aViewMgr)
|
||||
{
|
||||
NS_IF_ADDREF(mViewManager);
|
||||
return mViewManager;
|
||||
aViewMgr = mViewManager;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIWidget * nsView :: GetWidget()
|
||||
NS_IMETHODIMP nsView :: GetWidget(nsIWidget *&aWidget)
|
||||
{
|
||||
NS_IF_ADDREF(mWindow);
|
||||
return mWindow;
|
||||
aWidget = mWindow;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop)
|
||||
NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop, PRBool &aResult)
|
||||
{
|
||||
nsIView *pRoot;
|
||||
PRBool clipres = PR_FALSE;
|
||||
@ -312,11 +322,13 @@ PRBool nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
|
||||
rc.Translate(posx, posy);
|
||||
|
||||
PRInt32 numkids = GetChildCount();
|
||||
PRInt32 numkids;
|
||||
GetChildCount(numkids);
|
||||
|
||||
for (PRInt32 cnt = 0; cnt < numkids; cnt++)
|
||||
{
|
||||
nsIView *kid = GetChild(cnt);
|
||||
nsIView *kid;
|
||||
GetChild(cnt, kid);
|
||||
|
||||
if (nsnull != kid)
|
||||
{
|
||||
@ -330,7 +342,7 @@ PRBool nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
// Translate damage area into kid's coordinate system
|
||||
nsRect kidDamageArea(damageArea.x - kidRect.x, damageArea.y - kidRect.y,
|
||||
damageArea.width, damageArea.height);
|
||||
clipres = kid->Paint(rc, kidDamageArea, aPaintFlags);
|
||||
kid->Paint(rc, kidDamageArea, aPaintFlags, nsnull, clipres);
|
||||
|
||||
if (clipres == PR_TRUE)
|
||||
break;
|
||||
@ -340,13 +352,17 @@ PRBool nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
|
||||
if ((clipres == PR_FALSE) && (mVis == nsViewVisibility_kShow))
|
||||
{
|
||||
float opacity = GetOpacity();
|
||||
float opacity;
|
||||
GetOpacity(opacity);
|
||||
|
||||
if (opacity > 0.0f)
|
||||
{
|
||||
rc.PushState();
|
||||
|
||||
if (HasTransparency() || (opacity < 1.0f))
|
||||
PRBool hasTransparency;
|
||||
HasTransparency(hasTransparency);
|
||||
|
||||
if (hasTransparency || (opacity < 1.0f))
|
||||
{
|
||||
//overview of algorithm:
|
||||
//1. clip is set to intersection of this view and whatever is
|
||||
@ -361,7 +377,8 @@ PRBool nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
|
||||
//walk down rendering only views within this clip
|
||||
|
||||
nsIView *child = GetNextSibling(), *prevchild = this;
|
||||
nsIView *child, *prevchild = this;
|
||||
GetNextSibling(child);
|
||||
|
||||
while (nsnull != child)
|
||||
{
|
||||
@ -379,15 +396,15 @@ PRBool nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
// Translate damage area into kid's coordinate system
|
||||
nsRect kidDamageArea(damageArea.x - kidRect.x, damageArea.y - kidRect.y,
|
||||
damageArea.width, damageArea.height);
|
||||
clipres = child->Paint(rc, kidDamageArea, aPaintFlags);
|
||||
child->Paint(rc, kidDamageArea, aPaintFlags, nsnull, clipres);
|
||||
}
|
||||
|
||||
prevchild = child;
|
||||
|
||||
child = child->GetNextSibling();
|
||||
child->GetNextSibling(child);
|
||||
|
||||
if (nsnull == child)
|
||||
child = child->GetParent();
|
||||
child->GetParent(child);
|
||||
|
||||
if (clipres == PR_TRUE)
|
||||
break;
|
||||
@ -476,10 +493,12 @@ PRBool nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
clipres = rc.SetClipRect(brect, nsClipCombine_kSubtract);
|
||||
}
|
||||
|
||||
return clipres;
|
||||
aResult = clipres;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsView :: Paint(nsIRenderingContext& rc, const nsIRegion& region, PRUint32 aPaintFlags)
|
||||
NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsIRegion& region,
|
||||
PRUint32 aPaintFlags, PRBool &aResult)
|
||||
{
|
||||
// XXX apply region to rc
|
||||
// XXX get bounding rect from region
|
||||
@ -493,29 +512,33 @@ PRBool nsView :: Paint(nsIRenderingContext& rc, const nsIRegion& region, PRUint3
|
||||
// NS_RELEASE(obs);
|
||||
// }
|
||||
//}
|
||||
return PR_FALSE;
|
||||
aResult = PR_FALSE;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsEventStatus nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags)
|
||||
NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
|
||||
nsEventStatus &aStatus)
|
||||
{
|
||||
//printf(" %d %d %d %d (%d,%d) \n", this, event->widget, event->widgetSupports,
|
||||
// event->message, event->point.x, event->point.y);
|
||||
nsEventStatus retval = nsEventStatus_eIgnore;
|
||||
aStatus = nsEventStatus_eIgnore;
|
||||
|
||||
//see if any of this view's children can process the event
|
||||
if (retval == nsEventStatus_eIgnore) {
|
||||
PRInt32 numkids = GetChildCount();
|
||||
if (aStatus == nsEventStatus_eIgnore) {
|
||||
PRInt32 numkids;
|
||||
nsRect trect;
|
||||
nscoord x, y;
|
||||
|
||||
GetChildCount(numkids);
|
||||
x = event->point.x;
|
||||
y = event->point.y;
|
||||
|
||||
for (PRInt32 cnt = 0; cnt < numkids; cnt++)
|
||||
{
|
||||
nsIView *pKid = GetChild(cnt);
|
||||
nsIView *pKid;
|
||||
nscoord lx, ly;
|
||||
|
||||
GetChild(cnt, pKid);
|
||||
pKid->GetBounds(trect);
|
||||
|
||||
lx = x - trect.x;
|
||||
@ -530,19 +553,19 @@ nsEventStatus nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags)
|
||||
event->point.x -= trect.x;
|
||||
event->point.y -= trect.y;
|
||||
|
||||
retval = pKid->HandleEvent(event, NS_VIEW_FLAG_CHECK_CHILDREN);
|
||||
pKid->HandleEvent(event, NS_VIEW_FLAG_CHECK_CHILDREN, aStatus);
|
||||
|
||||
event->point.x += trect.x;
|
||||
event->point.y += trect.y;
|
||||
|
||||
if (retval != nsEventStatus_eIgnore)
|
||||
if (aStatus != nsEventStatus_eIgnore)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the view's children didn't take the event, check the view itself.
|
||||
if ((retval == nsEventStatus_eIgnore) && (nsnull != mClientData))
|
||||
if ((aStatus == nsEventStatus_eIgnore) && (nsnull != mClientData))
|
||||
{
|
||||
nsIViewObserver *obs;
|
||||
|
||||
@ -555,7 +578,7 @@ nsEventStatus nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags)
|
||||
event->point.x += xoff;
|
||||
event->point.y += yoff;
|
||||
|
||||
obs->HandleEvent((nsIView *)this, event, retval);
|
||||
obs->HandleEvent((nsIView *)this, event, aStatus);
|
||||
|
||||
event->point.x -= xoff;
|
||||
event->point.y -= yoff;
|
||||
@ -564,10 +587,10 @@ nsEventStatus nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags)
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetPosition(nscoord x, nscoord y)
|
||||
NS_IMETHODIMP nsView :: SetPosition(nscoord x, nscoord y)
|
||||
{
|
||||
mBounds.MoveTo(x, y);
|
||||
|
||||
@ -583,7 +606,7 @@ void nsView :: SetPosition(nscoord x, nscoord y)
|
||||
|
||||
GetScrollOffset(&offx, &offy);
|
||||
|
||||
pwidget = GetOffsetFromWidget(&parx, &pary);
|
||||
GetOffsetFromWidget(&parx, &pary, pwidget);
|
||||
NS_IF_RELEASE(pwidget);
|
||||
|
||||
mWindow->Move(NSTwipsToIntPixels((x + parx - offx), scale),
|
||||
@ -591,9 +614,11 @@ void nsView :: SetPosition(nscoord x, nscoord y)
|
||||
|
||||
NS_RELEASE(dx);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: GetPosition(nscoord *x, nscoord *y)
|
||||
NS_IMETHODIMP nsView :: GetPosition(nscoord *x, nscoord *y)
|
||||
{
|
||||
nsIView *rootView;
|
||||
|
||||
@ -605,9 +630,11 @@ void nsView :: GetPosition(nscoord *x, nscoord *y)
|
||||
*x = mBounds.x;
|
||||
*y = mBounds.y;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
NS_IMETHODIMP nsView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
{
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
@ -636,27 +663,32 @@ void nsView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
|
||||
NS_RELEASE(dx);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: GetDimensions(nscoord *width, nscoord *height)
|
||||
NS_IMETHODIMP nsView :: GetDimensions(nscoord *width, nscoord *height)
|
||||
{
|
||||
*width = mBounds.width;
|
||||
*height = mBounds.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetBounds(const nsRect &aBounds, PRBool aPaint)
|
||||
NS_IMETHODIMP nsView :: SetBounds(const nsRect &aBounds, PRBool aPaint)
|
||||
{
|
||||
SetPosition(aBounds.x, aBounds.y);
|
||||
SetDimensions(aBounds.width, aBounds.height, aPaint);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aPaint)
|
||||
NS_IMETHODIMP nsView :: SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aPaint)
|
||||
{
|
||||
SetPosition(aX, aY);
|
||||
SetDimensions(aWidth, aHeight, aPaint);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: GetBounds(nsRect &aBounds) const
|
||||
NS_IMETHODIMP nsView :: GetBounds(nsRect &aBounds) const
|
||||
{
|
||||
nsIView *rootView;
|
||||
|
||||
@ -665,32 +697,37 @@ void nsView :: GetBounds(nsRect &aBounds) const
|
||||
|
||||
if ((nsIView *)this == rootView)
|
||||
aBounds.x = aBounds.y = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetClip(nscoord aLeft, nscoord aTop, nscoord aRight, nscoord aBottom)
|
||||
NS_IMETHODIMP nsView :: SetClip(nscoord aLeft, nscoord aTop, nscoord aRight, nscoord aBottom)
|
||||
{
|
||||
mClip.mLeft = aLeft;
|
||||
mClip.mTop = aTop;
|
||||
mClip.mRight = aRight;
|
||||
mClip.mBottom = aBottom;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsView :: GetClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom)
|
||||
NS_IMETHODIMP nsView :: GetClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom,
|
||||
PRBool &aResult)
|
||||
{
|
||||
if ((mClip.mLeft == mClip.mRight) || (mClip.mTop == mClip.mBottom))
|
||||
return PR_FALSE;
|
||||
aResult = PR_FALSE;
|
||||
else
|
||||
{
|
||||
*aLeft = mClip.mLeft;
|
||||
*aTop = mClip.mTop;
|
||||
*aRight = mClip.mRight;
|
||||
*aBottom = mClip.mBottom;
|
||||
|
||||
return PR_TRUE;
|
||||
aResult = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetVisibility(nsViewVisibility aVisibility)
|
||||
NS_IMETHODIMP nsView :: SetVisibility(nsViewVisibility aVisibility)
|
||||
{
|
||||
mVis = aVisibility;
|
||||
|
||||
@ -703,53 +740,68 @@ void nsView :: SetVisibility(nsViewVisibility aVisibility)
|
||||
#endif
|
||||
mWindow->Show(PR_FALSE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsViewVisibility nsView :: GetVisibility()
|
||||
NS_IMETHODIMP nsView :: GetVisibility(nsViewVisibility &aVisibility)
|
||||
{
|
||||
return mVis;
|
||||
aVisibility = mVis;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetZIndex(PRInt32 zindex)
|
||||
NS_IMETHODIMP nsView :: SetZIndex(PRInt32 zindex)
|
||||
{
|
||||
mZindex = zindex;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 nsView :: GetZIndex()
|
||||
NS_IMETHODIMP nsView :: GetZIndex(PRInt32 &aZIndex)
|
||||
{
|
||||
return mZindex;
|
||||
aZIndex = mZindex;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetParent(nsIView *aParent)
|
||||
NS_IMETHODIMP nsView :: SetParent(nsIView *aParent)
|
||||
{
|
||||
mParent = aParent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIView * nsView :: GetParent()
|
||||
NS_IMETHODIMP nsView :: GetParent(nsIView *&aParent)
|
||||
{
|
||||
return mParent;
|
||||
aParent = mParent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIView * nsView :: GetNextSibling() const
|
||||
NS_IMETHODIMP nsView :: GetNextSibling(nsIView *&aNextSibling) const
|
||||
{
|
||||
return mNextSibling;
|
||||
aNextSibling = mNextSibling;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView::SetNextSibling(nsIView* aView)
|
||||
NS_IMETHODIMP nsView::SetNextSibling(nsIView* aView)
|
||||
{
|
||||
mNextSibling = aView;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: InsertChild(nsIView *child, nsIView *sibling)
|
||||
NS_IMETHODIMP nsView :: InsertChild(nsIView *child, nsIView *sibling)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != child, "null ptr");
|
||||
if (nsnull != child)
|
||||
{
|
||||
if (nsnull != sibling)
|
||||
{
|
||||
NS_ASSERTION(!(sibling->GetParent() != this), "tried to insert view with invalid sibling");
|
||||
#ifdef NS_DEBUG
|
||||
nsIView* siblingParent;
|
||||
sibling->GetParent(siblingParent);
|
||||
NS_ASSERTION(siblingParent == this, "tried to insert view with invalid sibling");
|
||||
#endif
|
||||
//insert after sibling
|
||||
child->SetNextSibling(sibling->GetNextSibling());
|
||||
nsIView* siblingNextSibling;
|
||||
sibling->GetNextSibling(siblingNextSibling);
|
||||
child->SetNextSibling(siblingNextSibling);
|
||||
sibling->SetNextSibling(child);
|
||||
}
|
||||
else
|
||||
@ -760,9 +812,11 @@ void nsView :: InsertChild(nsIView *child, nsIView *sibling)
|
||||
child->SetParent(this);
|
||||
mNumKids++;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: RemoveChild(nsIView *child)
|
||||
NS_IMETHODIMP nsView :: RemoveChild(nsIView *child)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != child, "null ptr");
|
||||
|
||||
@ -774,9 +828,11 @@ void nsView :: RemoveChild(nsIView *child)
|
||||
while (nsnull != kid) {
|
||||
if (kid == child) {
|
||||
if (nsnull != prevKid) {
|
||||
prevKid->SetNextSibling(kid->GetNextSibling());
|
||||
nsIView* kidNextSibling;
|
||||
kid->GetNextSibling(kidNextSibling);
|
||||
prevKid->SetNextSibling(kidNextSibling);
|
||||
} else {
|
||||
mFirstChild = kid->GetNextSibling();
|
||||
kid->GetNextSibling(mFirstChild);
|
||||
}
|
||||
child->SetParent(nsnull);
|
||||
mNumKids--;
|
||||
@ -784,79 +840,94 @@ void nsView :: RemoveChild(nsIView *child)
|
||||
break;
|
||||
}
|
||||
prevKid = kid;
|
||||
kid = kid->GetNextSibling();
|
||||
kid->GetNextSibling(kid);
|
||||
}
|
||||
NS_ASSERTION(found, "tried to remove non child");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 nsView :: GetChildCount()
|
||||
NS_IMETHODIMP nsView :: GetChildCount(PRInt32 &aCount)
|
||||
{
|
||||
return mNumKids;
|
||||
aCount = mNumKids;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIView * nsView :: GetChild(PRInt32 index)
|
||||
NS_IMETHODIMP nsView :: GetChild(PRInt32 index, nsIView *&aChild)
|
||||
{
|
||||
NS_PRECONDITION(!(index > mNumKids), "bad index");
|
||||
|
||||
aChild = nsnull;
|
||||
if (index < mNumKids)
|
||||
{
|
||||
nsIView *kid = mFirstChild;
|
||||
for (PRInt32 cnt = 0; (cnt < index) && (nsnull != kid); cnt++) {
|
||||
kid = kid->GetNextSibling();
|
||||
aChild = mFirstChild;
|
||||
for (PRInt32 cnt = 0; (cnt < index) && (nsnull != aChild); cnt++) {
|
||||
aChild->GetNextSibling(aChild);
|
||||
}
|
||||
return kid;
|
||||
}
|
||||
return nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetTransform(nsTransform2D &aXForm)
|
||||
NS_IMETHODIMP nsView :: SetTransform(nsTransform2D &aXForm)
|
||||
{
|
||||
if (nsnull == mXForm)
|
||||
mXForm = new nsTransform2D(&aXForm);
|
||||
else
|
||||
*mXForm = aXForm;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: GetTransform(nsTransform2D &aXForm)
|
||||
NS_IMETHODIMP nsView :: GetTransform(nsTransform2D &aXForm)
|
||||
{
|
||||
if (nsnull != mXForm)
|
||||
aXForm = *mXForm;
|
||||
else
|
||||
aXForm.SetToIdentity();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetOpacity(float opacity)
|
||||
NS_IMETHODIMP nsView :: SetOpacity(float opacity)
|
||||
{
|
||||
mOpacity = opacity;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float nsView :: GetOpacity()
|
||||
NS_IMETHODIMP nsView :: GetOpacity(float &aOpacity)
|
||||
{
|
||||
return mOpacity;
|
||||
aOpacity = mOpacity;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsView :: HasTransparency()
|
||||
NS_IMETHODIMP nsView :: HasTransparency(PRBool &aTransparent)
|
||||
{
|
||||
return (mVFlags & VIEW_FLAG_TRANSPARENT) ? PR_TRUE : PR_FALSE;
|
||||
aTransparent = (mVFlags & VIEW_FLAG_TRANSPARENT) ? PR_TRUE : PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetContentTransparency(PRBool aTransparent)
|
||||
NS_IMETHODIMP nsView :: SetContentTransparency(PRBool aTransparent)
|
||||
{
|
||||
if (aTransparent == PR_TRUE)
|
||||
mVFlags |= VIEW_FLAG_TRANSPARENT;
|
||||
else
|
||||
mVFlags &= ~VIEW_FLAG_TRANSPARENT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: SetClientData(void *aData)
|
||||
NS_IMETHODIMP nsView :: SetClientData(void *aData)
|
||||
{
|
||||
mClientData = aData;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void * nsView :: GetClientData(void)
|
||||
NS_IMETHODIMP nsView :: GetClientData(void *&aData)
|
||||
{
|
||||
return mClientData;
|
||||
aData = mClientData;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
@ -903,21 +974,22 @@ void nsView :: List(FILE* out, PRInt32 aIndent) const
|
||||
nsIView* kid = mFirstChild;
|
||||
while (nsnull != kid) {
|
||||
kid->List(out, aIndent + 1);
|
||||
kid = kid->GetNextSibling();
|
||||
kid->GetNextSibling(kid);
|
||||
}
|
||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||
fputs(">\n", out);
|
||||
}
|
||||
|
||||
nsIWidget * nsView :: GetOffsetFromWidget(nscoord *aDx, nscoord *aDy)
|
||||
NS_IMETHODIMP nsView :: GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget)
|
||||
{
|
||||
nsIWidget *window = nsnull;
|
||||
nsIView *ancestor = GetParent();
|
||||
|
||||
nsIView *ancestor;
|
||||
|
||||
GetParent(ancestor);
|
||||
while (nsnull != ancestor)
|
||||
{
|
||||
if (nsnull != (window = ancestor->GetWidget()))
|
||||
return window;
|
||||
ancestor->GetWidget(aWidget);
|
||||
if (nsnull != aWidget)
|
||||
return NS_OK;
|
||||
|
||||
if ((nsnull != aDx) && (nsnull != aDy))
|
||||
{
|
||||
@ -929,17 +1001,19 @@ nsIWidget * nsView :: GetOffsetFromWidget(nscoord *aDx, nscoord *aDy)
|
||||
*aDy += offy;
|
||||
}
|
||||
|
||||
ancestor = ancestor->GetParent();
|
||||
ancestor->GetParent(ancestor);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
aWidget = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsView :: GetScrollOffset(nscoord *aDx, nscoord *aDy)
|
||||
NS_IMETHODIMP nsView :: GetScrollOffset(nscoord *aDx, nscoord *aDy)
|
||||
{
|
||||
nsIWidget *window = nsnull;
|
||||
nsIView *ancestor = GetParent();
|
||||
|
||||
nsIView *ancestor;
|
||||
|
||||
GetParent(ancestor);
|
||||
while (nsnull != ancestor)
|
||||
{
|
||||
nsIScrollableView *sview;
|
||||
@ -949,11 +1023,12 @@ void nsView :: GetScrollOffset(nscoord *aDx, nscoord *aDy)
|
||||
if (NS_OK == ancestor->QueryInterface(kscroller, (void **)&sview))
|
||||
{
|
||||
sview->GetVisibleOffset(aDx, aDy);
|
||||
return;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ancestor = ancestor->GetParent();
|
||||
ancestor->GetParent(ancestor);
|
||||
}
|
||||
|
||||
*aDx = *aDy = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -45,56 +45,57 @@ public:
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
// nsIView
|
||||
virtual nsresult Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsCID *aWindowIID = nsnull,
|
||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||
nsNativeWidget aNative = nsnull,
|
||||
PRInt32 aZIndex = 0,
|
||||
const nsViewClip *aClip = nsnull,
|
||||
float aOpacity = 1.0f,
|
||||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
|
||||
NS_IMETHOD Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
nsIView *aParent,
|
||||
const nsCID *aWindowIID = nsnull,
|
||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||
nsNativeWidget aNative = nsnull,
|
||||
PRInt32 aZIndex = 0,
|
||||
const nsViewClip *aClip = nsnull,
|
||||
float aOpacity = 1.0f,
|
||||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
|
||||
|
||||
virtual void Destroy();
|
||||
virtual nsIViewManager * GetViewManager();
|
||||
virtual nsIWidget * GetWidget();
|
||||
virtual PRBool Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop = nsnull);
|
||||
virtual PRBool Paint(nsIRenderingContext& rc, const nsIRegion& region, PRUint32 aPaintFlags);
|
||||
virtual nsEventStatus HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags);
|
||||
virtual void SetPosition(nscoord x, nscoord y);
|
||||
virtual void GetPosition(nscoord *x, nscoord *y);
|
||||
virtual void SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
virtual void GetDimensions(nscoord *width, nscoord *height);
|
||||
virtual void SetBounds(const nsRect &aBounds, PRBool aPaint = PR_TRUE);
|
||||
virtual void SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aPaint = PR_TRUE);
|
||||
virtual void GetBounds(nsRect &aBounds) const;
|
||||
virtual void SetClip(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual PRBool GetClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom);
|
||||
virtual void SetVisibility(nsViewVisibility visibility);
|
||||
virtual nsViewVisibility GetVisibility();
|
||||
virtual void SetZIndex(PRInt32 zindex);
|
||||
virtual PRInt32 GetZIndex();
|
||||
virtual void SetParent(nsIView *aParent);
|
||||
virtual nsIView *GetParent();
|
||||
virtual nsIView* GetNextSibling() const;
|
||||
virtual void SetNextSibling(nsIView* aNextSibling);
|
||||
virtual void InsertChild(nsIView *child, nsIView *sibling);
|
||||
virtual void RemoveChild(nsIView *child);
|
||||
virtual PRInt32 GetChildCount();
|
||||
virtual nsIView * GetChild(PRInt32 index);
|
||||
virtual void SetTransform(nsTransform2D &aXForm);
|
||||
virtual void GetTransform(nsTransform2D &aXForm);
|
||||
virtual void SetOpacity(float opacity);
|
||||
virtual float GetOpacity();
|
||||
virtual PRBool HasTransparency();
|
||||
virtual void SetContentTransparency(PRBool aTransparent);
|
||||
NS_IMETHOD Destroy();
|
||||
NS_IMETHOD GetViewManager(nsIViewManager *&aViewMgr);
|
||||
NS_IMETHOD GetWidget(nsIWidget *&aWidget);
|
||||
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsRect& rect,
|
||||
PRUint32 aPaintFlags, nsIView *aBackstop, PRBool &aResult);
|
||||
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsIRegion& region,
|
||||
PRUint32 aPaintFlags, PRBool &aResult);
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, nsEventStatus &aStatus);
|
||||
NS_IMETHOD SetPosition(nscoord x, nscoord y);
|
||||
NS_IMETHOD GetPosition(nscoord *x, nscoord *y);
|
||||
NS_IMETHOD SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
NS_IMETHOD GetDimensions(nscoord *width, nscoord *height);
|
||||
NS_IMETHOD SetBounds(const nsRect &aBounds, PRBool aPaint = PR_TRUE);
|
||||
NS_IMETHOD SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aPaint = PR_TRUE);
|
||||
NS_IMETHOD GetBounds(nsRect &aBounds) const;
|
||||
NS_IMETHOD SetClip(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD GetClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom, PRBool &aResult);
|
||||
NS_IMETHOD SetVisibility(nsViewVisibility visibility);
|
||||
NS_IMETHOD GetVisibility(nsViewVisibility &aVisibility);
|
||||
NS_IMETHOD SetZIndex(PRInt32 zindex);
|
||||
NS_IMETHOD GetZIndex(PRInt32 &aZIndex);
|
||||
NS_IMETHOD SetParent(nsIView *aParent);
|
||||
NS_IMETHOD GetParent(nsIView *&aParent);
|
||||
NS_IMETHOD GetNextSibling(nsIView *&aNextSibling) const;
|
||||
NS_IMETHOD SetNextSibling(nsIView* aNextSibling);
|
||||
NS_IMETHOD InsertChild(nsIView *child, nsIView *sibling);
|
||||
NS_IMETHOD RemoveChild(nsIView *child);
|
||||
NS_IMETHOD GetChildCount(PRInt32 &aCount);
|
||||
NS_IMETHOD GetChild(PRInt32 index, nsIView*& aChild);
|
||||
NS_IMETHOD SetTransform(nsTransform2D &aXForm);
|
||||
NS_IMETHOD GetTransform(nsTransform2D &aXForm);
|
||||
NS_IMETHOD SetOpacity(float opacity);
|
||||
NS_IMETHOD GetOpacity(float &aOpacity);
|
||||
NS_IMETHOD HasTransparency(PRBool &aTransparent);
|
||||
NS_IMETHOD SetContentTransparency(PRBool aTransparent);
|
||||
NS_IMETHOD SetClientData(void *aData);
|
||||
NS_IMETHOD GetClientData(void *&aData);
|
||||
NS_IMETHOD GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget);
|
||||
NS_IMETHOD GetScrollOffset(nscoord *aDx, nscoord *aDy);
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
virtual void SetClientData(void *aData);
|
||||
virtual void * GetClientData();
|
||||
virtual nsIWidget * GetOffsetFromWidget(nscoord *aDx, nscoord *aDy);
|
||||
virtual void GetScrollOffset(nscoord *aDx, nscoord *aDy);
|
||||
|
||||
// Helper function to get the view that's associated with a widget
|
||||
static nsIView* GetViewFor(nsIWidget* aWidget);
|
||||
|
@ -176,7 +176,7 @@ NS_IMETHODIMP nsViewManager :: SetRootView(nsIView *aView)
|
||||
NS_IF_RELEASE(mRootWindow);
|
||||
|
||||
if (nsnull != mRootView)
|
||||
mRootWindow = mRootView->GetWidget();
|
||||
mRootView->GetWidget(mRootWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -351,7 +351,8 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsI
|
||||
region->GetBoundingBox(&trect.x, &trect.y, &trect.width, &trect.height);
|
||||
trect.ScaleRoundOut(p2t);
|
||||
|
||||
aView->Paint(*localcx, trect, 0);
|
||||
PRBool result;
|
||||
aView->Paint(*localcx, trect, 0, nsnull, result);
|
||||
|
||||
if (aUpdateFlags & NS_VMREFRESH_DOUBLE_BUFFER)
|
||||
localcx->CopyOffScreenBits(wrect);
|
||||
@ -431,7 +432,8 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsR
|
||||
localcx->SetClipRect(trect, nsClipCombine_kReplace);
|
||||
}
|
||||
|
||||
aView->Paint(*localcx, trect, 0);
|
||||
PRBool result;
|
||||
aView->Paint(*localcx, trect, 0, nsnull, result);
|
||||
|
||||
if (aUpdateFlags & NS_VMREFRESH_DOUBLE_BUFFER)
|
||||
localcx->CopyOffScreenBits(wrect);
|
||||
@ -540,8 +542,10 @@ NS_IMETHODIMP nsViewManager :: UpdateView(nsIView *aView, const nsRect &aRect, P
|
||||
|
||||
trect.x += x;
|
||||
trect.y += y;
|
||||
|
||||
par->GetParent(par);
|
||||
}
|
||||
while (par = par->GetParent());
|
||||
while (nsnull != par);
|
||||
}
|
||||
|
||||
//printf("updating... ");
|
||||
@ -733,9 +737,10 @@ NS_IMETHODIMP nsViewManager :: DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &
|
||||
aEvent->point.y = NSIntPixelsToTwips(aEvent->point.y, p2t);
|
||||
|
||||
|
||||
aStatus = view->HandleEvent(aEvent, NS_VIEW_FLAG_CHECK_CHILDREN |
|
||||
NS_VIEW_FLAG_CHECK_PARENT |
|
||||
NS_VIEW_FLAG_CHECK_SIBLINGS);
|
||||
view->HandleEvent(aEvent, NS_VIEW_FLAG_CHECK_CHILDREN |
|
||||
NS_VIEW_FLAG_CHECK_PARENT |
|
||||
NS_VIEW_FLAG_CHECK_SIBLINGS,
|
||||
aStatus);
|
||||
|
||||
aEvent->point.x = NSTwipsToIntPixels(aEvent->point.x, t2p);
|
||||
aEvent->point.y = NSTwipsToIntPixels(aEvent->point.y, t2p);
|
||||
@ -780,7 +785,8 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, nsIV
|
||||
|
||||
if ((nsnull != parent) && (nsnull != child))
|
||||
{
|
||||
PRInt32 numkids = parent->GetChildCount();
|
||||
PRInt32 numkids;
|
||||
parent->GetChildCount(numkids);
|
||||
nsIView *kid = nsnull, *prev = nsnull;
|
||||
|
||||
//verify that the sibling exists...
|
||||
@ -788,7 +794,7 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, nsIV
|
||||
for (PRInt32 cnt = 0; cnt < numkids; cnt++)
|
||||
{
|
||||
// XXX This is extremely inefficient...
|
||||
kid = parent->GetChild(cnt);
|
||||
parent->GetChild(cnt, kid);
|
||||
|
||||
if (kid == sibling)
|
||||
break;
|
||||
@ -810,7 +816,9 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, nsIV
|
||||
|
||||
//and mark this area as dirty if the view is visible...
|
||||
|
||||
if (child->GetVisibility() != nsViewVisibility_kHide)
|
||||
nsViewVisibility visibility;
|
||||
child->GetVisibility(visibility);
|
||||
if (nsViewVisibility_kHide != visibility)
|
||||
UpdateView(child, nsnull, 0);
|
||||
}
|
||||
return NS_OK;
|
||||
@ -823,7 +831,8 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, PRIn
|
||||
|
||||
if ((nsnull != parent) && (nsnull != child))
|
||||
{
|
||||
PRInt32 numkids = parent->GetChildCount();
|
||||
PRInt32 numkids;
|
||||
parent->GetChildCount(numkids);
|
||||
nsIView *kid = nsnull, *prev = nsnull;
|
||||
|
||||
//find the right insertion point...
|
||||
@ -833,9 +842,9 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, PRIn
|
||||
PRInt32 idx;
|
||||
|
||||
// XXX This is extremely inefficient...
|
||||
kid = parent->GetChild(cnt);
|
||||
parent->GetChild(cnt, kid);
|
||||
|
||||
idx = kid->GetZIndex();
|
||||
kid->GetZIndex(idx);
|
||||
|
||||
if (zindex < idx)
|
||||
break;
|
||||
@ -851,8 +860,9 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, PRIn
|
||||
UpdateTransCnt(nsnull, child);
|
||||
|
||||
//and mark this area as dirty if the view is visible...
|
||||
|
||||
if (child->GetVisibility() != nsViewVisibility_kHide)
|
||||
nsViewVisibility visibility;
|
||||
child->GetVisibility(visibility);
|
||||
if (nsViewVisibility_kHide != visibility)
|
||||
UpdateView(child, nsnull, 0);
|
||||
}
|
||||
return NS_OK;
|
||||
@ -893,12 +903,15 @@ NS_IMETHODIMP nsViewManager :: MoveViewTo(nsIView *aView, nscoord aX, nscoord aY
|
||||
|
||||
if ((aX != oldX) || (aY != oldY))
|
||||
{
|
||||
if (nsViewVisibility_kHide != aView->GetVisibility())
|
||||
nsViewVisibility visibility;
|
||||
aView->GetVisibility(visibility);
|
||||
if (visibility != nsViewVisibility_kHide)
|
||||
{
|
||||
nsRect bounds;
|
||||
aView->GetBounds(bounds);
|
||||
nsRect oldArea(oldX, oldY, bounds.width, bounds.height);
|
||||
nsIView* parent = aView->GetParent(); // no addref
|
||||
nsIView* parent;
|
||||
aView->GetParent(parent);
|
||||
UpdateView(parent, oldArea, 0);
|
||||
nsRect newArea(aX, aY, bounds.width, bounds.height);
|
||||
UpdateView(parent, newArea, 0);
|
||||
@ -938,7 +951,8 @@ NS_IMETHODIMP nsViewManager :: ResizeView(nsIView *aView, nscoord width, nscoord
|
||||
|
||||
aView->SetDimensions(width, height);
|
||||
|
||||
nsIView *parent = aView->GetParent(); // no addref
|
||||
nsIView *parent;
|
||||
aView->GetParent(parent);
|
||||
|
||||
if (nsnull == parent)
|
||||
{
|
||||
@ -1012,7 +1026,9 @@ NS_IMETHODIMP nsViewManager :: GetViewClipAbsolute(nsIView *aView, nsRect *rect,
|
||||
|
||||
NS_IMETHODIMP nsViewManager :: SetViewContentTransparency(nsIView *aView, PRBool aTransparent)
|
||||
{
|
||||
if (aTransparent != aView->HasTransparency())
|
||||
PRBool hasTransparency;
|
||||
aView->HasTransparency(hasTransparency);
|
||||
if (aTransparent != hasTransparency)
|
||||
{
|
||||
if (aTransparent == PR_FALSE)
|
||||
{
|
||||
@ -1040,7 +1056,7 @@ NS_IMETHODIMP nsViewManager :: SetViewOpacity(nsIView *aView, float aOpacity)
|
||||
else
|
||||
newopaque = PR_FALSE;
|
||||
|
||||
oldopacity = aView->GetOpacity();
|
||||
aView->GetOpacity(oldopacity);
|
||||
|
||||
if ((oldopacity == 1.0f) || (oldopacity == 0.0f))
|
||||
oldopaque = PR_TRUE;
|
||||
@ -1146,7 +1162,7 @@ NS_IMETHODIMP nsViewManager :: GetShowQuality(PRBool &aResult)
|
||||
|
||||
retval = mRootView->QueryInterface(kIScrollableViewIID, (void **)&scroller);
|
||||
if (NS_SUCCEEDED(retval)) {
|
||||
aResult = scroller->GetShowQuality();
|
||||
scroller->GetShowQuality(aResult);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@ -1175,7 +1191,7 @@ nsIRenderingContext * nsViewManager :: CreateRenderingContext(nsIView &aView)
|
||||
|
||||
do
|
||||
{
|
||||
win = par->GetWidget();
|
||||
par->GetWidget(win);
|
||||
|
||||
if (nsnull != win)
|
||||
break;
|
||||
@ -1193,8 +1209,10 @@ nsIRenderingContext * nsViewManager :: CreateRenderingContext(nsIView &aView)
|
||||
ax += x;
|
||||
ay += y;
|
||||
}
|
||||
|
||||
par->GetParent(par);
|
||||
}
|
||||
while (par = par->GetParent());
|
||||
while (nsnull != par);
|
||||
|
||||
if (nsnull != win)
|
||||
{
|
||||
@ -1238,13 +1256,27 @@ void nsViewManager :: AddRectToDirtyRegion(nsRect &aRect)
|
||||
|
||||
void nsViewManager :: UpdateTransCnt(nsIView *oldview, nsIView *newview)
|
||||
{
|
||||
if ((nsnull != oldview) && (oldview->HasTransparency() ||
|
||||
(oldview->GetOpacity() != 1.0f)))
|
||||
mTransCnt--;
|
||||
if (nsnull != oldview) {
|
||||
PRBool hasTransparency;
|
||||
float opacity;
|
||||
|
||||
if ((nsnull != newview) && (newview->HasTransparency() ||
|
||||
(newview->GetOpacity() != 1.0f)))
|
||||
mTransCnt++;
|
||||
oldview->HasTransparency(hasTransparency);
|
||||
oldview->GetOpacity(opacity);
|
||||
|
||||
if (hasTransparency || (1.0f != opacity))
|
||||
mTransCnt--;
|
||||
}
|
||||
|
||||
if (nsnull != newview) {
|
||||
PRBool hasTransparency;
|
||||
float opacity;
|
||||
|
||||
newview->HasTransparency(hasTransparency);
|
||||
newview->GetOpacity(opacity);
|
||||
|
||||
if (hasTransparency || (1.0f != opacity))
|
||||
mTransCnt++;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager :: DisableRefresh(void)
|
||||
|
@ -527,7 +527,7 @@ nsresult DocumentViewerImpl::MakeWindow(nsNativeWidget aNativeParent,
|
||||
|
||||
// Setup hierarchical relationship in view manager
|
||||
mViewManager->SetRootView(mView);
|
||||
mWindow = mView->GetWidget();
|
||||
mView->GetWidget(mWindow);
|
||||
|
||||
//set frame rate to 25 fps
|
||||
mViewManager->SetFrameRate(25);
|
||||
|
Loading…
x
Reference in New Issue
Block a user