make the menu positioning use the new look&feel metric for whether or not popups can appear over the taskbar/menubar bug 21154. r=hyatt.

This commit is contained in:
pinkerton%netscape.com 2000-03-23 21:10:09 +00:00
Родитель 931f86c6b0
Коммит 2235d820f9
2 изменённых файлов: 24 добавлений и 5 удалений

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

@ -20,6 +20,7 @@
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
* Mike Pinkerton (pinkerton@netscape.com)
* Dean Tessman <dean_tessman@hotmail.com>
*/
@ -101,8 +102,9 @@ NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
//
// nsMenuPopupFrame ctor
//
nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell):nsBoxFrame(aShell),
mCurrentMenu(nsnull), mTimerMenu(nsnull), mCloseTimer(nsnull)
nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell)
:nsBoxFrame(aShell), mCurrentMenu(nsnull), mTimerMenu(nsnull), mCloseTimer(nsnull),
mMenuCanOverlapOSBar(PR_FALSE)
{
SetIsContextMenu(PR_FALSE); // we're not a context menu by default
@ -118,6 +120,14 @@ nsMenuPopupFrame::Init(nsIPresContext* aPresContext,
{
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
// lookup if we're allowed to overlap the OS bar (menubar/taskbar) from the
// look&feel object
nsCOMPtr<nsILookAndFeel> lookAndFeel;
nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID,
getter_AddRefs(lookAndFeel));
if ( lookAndFeel )
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_MenusCanOverlapOSBar, mMenuCanOverlapOSBar);
// XXX Hack
mPresContext = aPresContext;
@ -532,8 +542,14 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
window->GetScreen(getter_AddRefs(screen));
PRInt32 screenWidth;
PRInt32 screenHeight;
screen->GetAvailWidth(&screenWidth);
screen->GetAvailHeight(&screenHeight);
if ( mMenuCanOverlapOSBar ) {
screen->GetWidth(&screenWidth);
screen->GetHeight(&screenHeight);
}
else {
screen->GetAvailWidth(&screenWidth);
screen->GetAvailHeight(&screenHeight);
}
// Compute info about the screen dimensions. Because of multiple monitor systems,
// the left or top sides of the screen may be in negative space (main monitor is on the

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

@ -19,7 +19,8 @@
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
* Contributor(s):
* Mike Pinkerton (pinkerton@netscape.com)
* Dean Tessman <dean_tessman@hotmail.com>
*/
@ -167,6 +168,8 @@ protected:
nsCOMPtr<nsITimer> mCloseTimer; // Close timer.
PRBool mIsContextMenu; // is this a context menu?
PRBool mMenuCanOverlapOSBar; // can we appear over the taskbar/menubar?
}; // class nsMenuPopupFrame