changed nsIView::Init() so that it no longer takes an opacity value. this

allows the view manager to maintain global state re: opacity.
This commit is contained in:
michaelp%netscape.com 1998-11-03 06:36:36 +00:00
Родитель 1fb3b1b22e
Коммит d2b75b1ba9
10 изменённых файлов: 24 добавлений и 26 удалений

Просмотреть файл

@ -257,8 +257,7 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
nsWidgetInitData* initData = GetWidgetInitData(aPresContext); // needs to be deleted
// initialize the view as hidden since we don't know the (x,y) until Paint
result = view->Init(viewMan, boundBox, parView, &id, initData,
nsnull, nsnull,
1.0f, nsViewVisibility_kHide);
nsnull, nsnull, nsViewVisibility_kHide);
if (nsnull != initData) {
delete(initData);
}

Просмотреть файл

@ -245,8 +245,7 @@ nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly)
// nsWidgetInitData* initData = GetWidgetInitData(*aPresContext); // needs to be deleted
// initialize the view as hidden since we don't know the (x,y) until Paint
result = view->Init(viewMan, boundBox, parView, &kWidgetCID, nsnull,
nsnull, nsnull,
1.0f, nsViewVisibility_kHide);
nsnull, nsnull, nsViewVisibility_kHide);
// if (nsnull != initData) {
// delete(initData);
// }

Просмотреть файл

@ -245,8 +245,7 @@ nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly)
// nsWidgetInitData* initData = GetWidgetInitData(*aPresContext); // needs to be deleted
// initialize the view as hidden since we don't know the (x,y) until Paint
result = view->Init(viewMan, boundBox, parView, &kWidgetCID, nsnull,
nsnull, nsnull,
1.0f, nsViewVisibility_kHide);
nsnull, nsnull, nsViewVisibility_kHide);
// if (nsnull != initData) {
// delete(initData);
// }

Просмотреть файл

@ -171,11 +171,14 @@ nsScrollFrame::CreateScrollingView()
// Initialize the scrolling view
view->Init(viewManager, mRect, parentView, nsnull, nsnull, nsnull,
nsnull, color->mOpacity);
nsnull);
// Insert the view into the view hierarchy
viewManager->InsertChild(parentView, view, zIndex);
// Set the view's opacity
viewManager->SetViewOpacity(view, color->mOpacity);
// If the background is transparent then inform the view manager
PRBool isTransparent = (NS_STYLE_BG_COLOR_TRANSPARENT & color->mBackgroundFlags);
if (isTransparent) {
@ -209,15 +212,18 @@ nsScrollFrame::CreateScrollingView()
// Initialize the view
scrolledView->Init(viewManager, nsRect(0, 0, 0, 0), parentView, nsnull,
nsnull, nsnull, nsnull, color->mOpacity);
nsnull, nsnull, nsnull);
// Set it as the scrolling view's scrolled view
scrollingView->SetScrolledView(scrolledView);
// If the background is transparent then inform the view manager
if (isTransparent) {
viewManager->SetViewContentTransparency(scrolledView, PR_TRUE);
}
// Set it as the scrolling view's scrolled view
scrollingView->SetScrolledView(scrolledView);
// Set the opacity
viewManager->SetViewOpacity(scrolledView, color->mOpacity);
// We need to allow the view's position to be different than the
// frame's position

Просмотреть файл

@ -257,8 +257,7 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
nsWidgetInitData* initData = GetWidgetInitData(aPresContext); // needs to be deleted
// initialize the view as hidden since we don't know the (x,y) until Paint
result = view->Init(viewMan, boundBox, parView, &id, initData,
nsnull, nsnull,
1.0f, nsViewVisibility_kHide);
nsnull, nsnull, nsViewVisibility_kHide);
if (nsnull != initData) {
delete(initData);
}

Просмотреть файл

@ -93,7 +93,6 @@ public:
* aWindowIID. if nsnull, then parent will be derived from
* parent view and it's ancestors
* @param aCilpRect initial clip rect of view
* @param aOpacity initial opacity of view
* @param aVisibilityFlag initial visibility state of view
* @result The result of the initialization, NS_OK if no errors
*/
@ -104,7 +103,6 @@ public:
nsWidgetInitData *aWidgetInitData = nsnull,
nsNativeWidget aNative = nsnull,
const nsViewClip *aClip = nsnull,
float aOpacity = 1.0f,
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow) = 0;
/**

Просмотреть файл

@ -402,13 +402,12 @@ NS_IMETHODIMP nsScrollingView :: Init(nsIViewManager* aManager,
nsWidgetInitData *aWidgetInitData,
nsNativeWidget aNative,
const nsViewClip *aClip,
float aOpacity,
nsViewVisibility aVisibilityFlag)
{
nsresult rv;
rv = nsView :: Init(aManager, aBounds, aParent, aWindowIID, aWidgetInitData,
aNative, aClip, aOpacity, aVisibilityFlag);
aNative, aClip, aVisibilityFlag);
if (rv == NS_OK)
{
@ -425,8 +424,9 @@ NS_IMETHODIMP nsScrollingView :: Init(nsIViewManager* aManager,
// of 0.0f (completely transparent)
// XXX The clip widget should be created on demand only...
rv = mClipView->Init(mViewManager, aBounds, this, &kWidgetCID, nsnull,
mWindow ? nsnull : aNative, nsnull, 0.0f);
mWindow ? nsnull : aNative, nsnull);
mViewManager->InsertChild(this, mClipView, -1);
mViewManager->SetViewOpacity(mClipView, 0.0f);
}
// Create a view for a corner cover
@ -444,7 +444,7 @@ NS_IMETHODIMP nsScrollingView :: Init(nsIViewManager* aManager,
trect.y = aBounds.y + aBounds.YMost() - trect.height;
rv = mCornerView->Init(mViewManager, trect, this, nsnull, nsnull, nsnull,
nsnull, 1.0f, nsViewVisibility_kHide);
nsnull, nsViewVisibility_kHide);
mViewManager->InsertChild(this, mCornerView, -1);
}

Просмотреть файл

@ -42,7 +42,6 @@ public:
nsWidgetInitData *aWidgetInitData = nsnull,
nsNativeWidget aNative = nsnull,
const nsViewClip *aClip = nsnull,
float aOpacity = 1.0f,
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
//overrides

Просмотреть файл

@ -70,6 +70,7 @@ nsView :: nsView()
mVis = nsViewVisibility_kShow;
mXForm = nsnull;
mVFlags = ~ALL_VIEW_FLAGS;
mOpacity = 1.0f;
}
nsView :: ~nsView()
@ -129,7 +130,9 @@ nsView :: ~nsView()
}
// Destroy and release the widget
if (nsnull != mWindow) {
if (nsnull != mWindow)
{
mWindow->SetClientData(nsnull);
mWindow->Destroy();
NS_RELEASE(mWindow);
@ -194,7 +197,6 @@ NS_IMETHODIMP nsView :: Init(nsIViewManager* aManager,
nsWidgetInitData *aWidgetInitData,
nsNativeWidget aNative,
const nsViewClip *aClip,
float aOpacity,
nsViewVisibility aVisibilityFlag)
{
//printf(" \n callback=%d data=%d", aWidgetCreateCallback, aCallbackData);
@ -218,8 +220,6 @@ NS_IMETHODIMP nsView :: Init(nsIViewManager* aManager,
mClip.mBottom = 0;
}
mOpacity = aOpacity;
SetBounds(aBounds);
//temporarily set it...

Просмотреть файл

@ -52,7 +52,6 @@ public:
nsWidgetInitData *aWidgetInitData = nsnull,
nsNativeWidget aNative = nsnull,
const nsViewClip *aClip = nsnull,
float aOpacity = 1.0f,
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
NS_IMETHOD Destroy();