adding numberOfScreens to interface. minor cleanup.

This commit is contained in:
pinkerton%netscape.com 2000-03-18 00:56:34 +00:00
Родитель 4412d25298
Коммит e17aeaff6f
5 изменённых файлов: 58 добавлений и 7 удалений

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

@ -32,12 +32,15 @@ interface nsIScreenManager : nsISupports
//
// The coordinates are in pixels (not twips) and in screen coordinates.
//
nsIScreen screenForRect ( in long top, in long left, in long width, in long height ) ;
nsIScreen screenForRect ( in long left, in long top, in long width, in long height ) ;
// The screen with the menubar/taskbar. This shouldn't be needed very
// often.
readonly attribute nsIScreen primaryScreen;
// Holds the number of screens that are available
readonly attribute unsigned long numberOfScreens;
};

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

@ -67,7 +67,7 @@ nsScreenManagerGtk :: CreateNewScreenObject ( )
// The coordinates are in pixels (not twips) and in screen coordinates.
//
NS_IMETHODIMP
nsScreenManagerGtk :: ScreenForRect ( PRInt32 /*inTop*/, PRInt32 /*inLeft*/, PRInt32 /*inWidth*/,
nsScreenManagerGtk :: ScreenForRect ( PRInt32 /*inLeft*/, PRInt32 /*inTop*/, PRInt32 /*inWidth*/,
PRInt32 /*inHeight*/, nsIScreen **outScreen )
{
GetPrimaryScreen ( outScreen );
@ -90,3 +90,17 @@ nsScreenManagerGtk :: GetPrimaryScreen(nsIScreen * *aPrimaryScreen)
} // GetPrimaryScreen
//
// GetNumberOfScreens
//
// Returns how many physical screens are available.
//
NS_IMETHODIMP
nsScreenManagerGtk :: GetNumberOfScreens(PRUint32 *aNumberOfScreens)
{
*aNumberOfScreens = 1;
return NS_OK;
} // GetNumberOfScreens

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

@ -67,11 +67,11 @@ nsScreenManagerMac :: CreateNewScreenObject ( GDHandle inDevice )
// The coordinates are in pixels (not twips) and in screen coordinates.
//
NS_IMETHODIMP
nsScreenManagerMac :: ScreenForRect ( PRInt32 inTop, PRInt32 inLeft, PRInt32 inWidth, PRInt32 inHeight,
nsScreenManagerMac :: ScreenForRect ( PRInt32 inLeft, PRInt32 inTop, PRInt32 inWidth, PRInt32 inHeight,
nsIScreen **outScreen )
{
if ( !(inTop || inLeft || inWidth || inHeight) ) {
NS_WARNING ( "trying to find screen for sizeless window" );
if ( !(inWidth || inHeight) ) {
NS_WARNING ( "trying to find screen for sizeless window, using primary monitor" );
*outScreen = CreateNewScreenObject ( ::GetMainDevice() ); // addrefs
return NS_OK;
}
@ -117,3 +117,23 @@ nsScreenManagerMac :: GetPrimaryScreen(nsIScreen * *aPrimaryScreen)
} // GetPrimaryScreen
//
// GetNumberOfScreens
//
// Returns how many physical screens are available.
//
NS_IMETHODIMP
nsScreenManagerMac :: GetNumberOfScreens(PRUint32 *aNumberOfScreens)
{
*aNumberOfScreens = 0;
GDHandle currDevice = ::GetDeviceList();
while ( currDevice ) {
if ( ::TestDeviceAttribute(currDevice, screenDevice) && ::TestDeviceAttribute(currDevice, screenActive) )
++(*aNumberOfScreens);
currDevice = ::GetNextDevice(currDevice);
}
return NS_OK;
} // GetNumberOfScreens

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

@ -34,7 +34,7 @@ class nsScreenManagerMac : public nsIScreenManager
{
public:
nsScreenManagerMac ( );
~nsScreenManagerMac();
virtual ~nsScreenManagerMac();
NS_DECL_ISUPPORTS
NS_DECL_NSISCREENMANAGER

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

@ -67,7 +67,7 @@ nsScreenManagerWin :: CreateNewScreenObject ( HDC inScreen )
// The coordinates are in pixels (not twips) and in screen coordinates.
//
NS_IMETHODIMP
nsScreenManagerWin :: ScreenForRect ( PRInt32 inTop, PRInt32 inLeft, PRInt32 inWidth, PRInt32 inHeight,
nsScreenManagerWin :: ScreenForRect ( PRInt32 inLeft, PRInt32 inTop, PRInt32 inWidth, PRInt32 inHeight,
nsIScreen **outScreen )
{
if ( !(inWidth || inHeight) ) {
@ -108,3 +108,17 @@ nsScreenManagerWin :: GetPrimaryScreen(nsIScreen** aPrimaryScreen)
} // GetPrimaryScreen
//
// GetNumberOfScreens
//
// Returns how many physical screens are available.
//
NS_IMETHODIMP
nsScreenManagerWin :: GetNumberOfScreens(PRUint32 *aNumberOfScreens)
{
*aNumberOfScreens = 1;
return NS_OK;
} // GetNumberOfScreens