Bug 352093. Part 2: Create nsIViewManager::GetRootWidget.

This commit is contained in:
Robert O'Callahan 2009-07-22 12:45:03 +12:00
Родитель f474c72e3b
Коммит 42155761e9
3 изменённых файлов: 26 добавлений и 3 удалений

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

@ -59,10 +59,9 @@ enum nsRectVisibility {
nsRectVisibility_kZeroAreaRect
};
// 98f676da-eb1a-467d-9c0e-0d64c2c88d85
#define NS_IVIEWMANAGER_IID \
{ 0x98f676da, 0xeb1a, 0x467d, \
{ 0x9c, 0x0e, 0x0d, 0x64, 0xc2, 0xc8, 0x8d, 0x85 } }
{ 0x50c0a18c, 0x3e39, 0x4606, \
{ 0x85, 0x77, 0xe7, 0x3a, 0xcc, 0xb4, 0x66, 0xc9 } }
class nsIViewManager : public nsISupports
{
@ -424,6 +423,12 @@ public:
*/
NS_IMETHOD GetWidget(nsIWidget **aWidget) = 0;
/**
* Retrieve the widget at the root of the nearest enclosing
* view manager whose root view has a widget.
*/
NS_IMETHOD GetRootWidget(nsIWidget **aWidget) = 0;
/**
* Force update of view manager widget
* Callers should use UpdateView(view, NS_VMREFRESH_IMMEDIATE) in most cases instead

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

@ -1874,6 +1874,23 @@ NS_IMETHODIMP nsViewManager::GetWidget(nsIWidget **aWidget)
return NS_OK;
}
NS_IMETHODIMP nsViewManager::GetRootWidget(nsIWidget **aWidget)
{
if (!mRootView) {
*aWidget = nsnull;
return NS_OK;
}
if (mRootView->HasWidget()) {
*aWidget = mRootView->GetWidget();
NS_ADDREF(*aWidget);
return NS_OK;
}
if (mRootView->GetParent())
return mRootView->GetParent()->GetViewManager()->GetRootWidget(aWidget);
*aWidget = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsViewManager::ForceUpdate()
{
if (!IsRootVM()) {

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

@ -173,6 +173,7 @@ public:
NS_IMETHOD GetWidget(nsIWidget **aWidget);
nsIWidget* GetWidget() { return mRootView ? mRootView->GetWidget() : nsnull; }
NS_IMETHOD GetRootWidget(nsIWidget **aWidget);
NS_IMETHOD ForceUpdate();
NS_IMETHOD IsPainting(PRBool& aIsPainting);