Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
nsScreen Class Reference

#include <nsScreen.h>

Inheritance diagram for nsScreen:
Inheritance graph
[legend]
Collaboration diagram for nsScreen:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsScreen (nsIDocShell *aDocShell)
virtual ~nsScreen ()
NS_IMETHOD SetDocShell (nsIDocShell *aDocShell)
NS_DECL_ISUPPORTS NS_IMETHOD GetTop (PRInt32 *aWidth)
NS_IMETHOD GetLeft (PRInt32 *aWidth)
NS_IMETHOD GetWidth (PRInt32 *aWidth)
NS_IMETHOD GetHeight (PRInt32 *aHeight)
NS_IMETHOD GetPixelDepth (PRInt32 *aPixelDepth)
NS_IMETHOD GetColorDepth (PRInt32 *aColorDepth)
NS_IMETHOD GetAvailWidth (PRInt32 *aAvailWidth)
NS_IMETHOD GetAvailHeight (PRInt32 *aAvailHeight)
NS_IMETHOD GetAvailLeft (PRInt32 *aAvailLeft)
NS_IMETHOD GetAvailTop (PRInt32 *aAvailTop)

Public Attributes

readonly attribute long top
readonly attribute long left
readonly attribute long width
readonly attribute long height
readonly attribute long pixelDepth
readonly attribute long colorDepth
readonly attribute long availWidth
readonly attribute long availHeight
readonly attribute long availLeft
readonly attribute long availTop

Protected Member Functions

nsIDeviceContextGetDeviceContext ()
nsresult GetRect (nsRect &aRect)
nsresult GetAvailRect (nsRect &aRect)

Protected Attributes

nsIDocShellmDocShell

Detailed Description

Definition at line 50 of file nsScreen.h.


Constructor & Destructor Documentation

nsScreen::nsScreen ( nsIDocShell aDocShell)

Definition at line 55 of file nsScreen.cpp.

  : mDocShell(aDocShell)
{
}
nsScreen::~nsScreen ( ) [virtual]

Definition at line 60 of file nsScreen.cpp.

{
}

Member Function Documentation

Definition at line 167 of file nsScreen.cpp.

{
  nsRect rect;
  nsresult rv = GetAvailRect(rect);

  *aAvailHeight = rect.height;

  return rv;
}

Here is the call graph for this function:

Definition at line 178 of file nsScreen.cpp.

{
  nsRect rect;
  nsresult rv = GetAvailRect(rect);

  *aAvailLeft = rect.x;

  return rv;
}

Here is the call graph for this function:

nsresult nsScreen::GetAvailRect ( nsRect aRect) [protected]

Definition at line 248 of file nsScreen.cpp.

{
  nsIDeviceContext *context = GetDeviceContext();

  if (!context) {
    return NS_ERROR_FAILURE;
  }

  context->GetClientRect(aRect);

  float devUnits;
  devUnits = context->DevUnitsToAppUnits();

  aRect.x = NSToIntRound(float(aRect.x) / devUnits);
  aRect.y = NSToIntRound(float(aRect.y) / devUnits);
  aRect.height = NSToIntRound(float(aRect.height) / devUnits);
  aRect.width = NSToIntRound(float(aRect.width) / devUnits);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 189 of file nsScreen.cpp.

{
  nsRect rect;
  nsresult rv = GetAvailRect(rect);

  *aAvailTop = rect.y;

  return rv;
}

Here is the call graph for this function:

Definition at line 156 of file nsScreen.cpp.

{
  nsRect rect;
  nsresult rv = GetAvailRect(rect);

  *aAvailWidth = rect.width;

  return rv;
}

Here is the call graph for this function:

Definition at line 150 of file nsScreen.cpp.

{
  return GetPixelDepth(aColorDepth);
}

Here is the call graph for this function:

Definition at line 200 of file nsScreen.cpp.

{
  if(!mDocShell)
    return nsnull;

  nsCOMPtr<nsIContentViewer> contentViewer;
  mDocShell->GetContentViewer(getter_AddRefs(contentViewer));

  nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(contentViewer));
  if(!docViewer)
    return nsnull;

  nsCOMPtr<nsPresContext> presContext;
  docViewer->GetPresContext(getter_AddRefs(presContext));

  nsIDeviceContext* context = nsnull;
  if(presContext)
    context = presContext->DeviceContext();

  return context;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 120 of file nsScreen.cpp.

{
  nsRect rect;
  nsresult rv = GetRect(rect);

  *aHeight = rect.height;

  return rv;
}

Here is the call graph for this function:

Definition at line 97 of file nsScreen.cpp.

{
  nsRect rect;
  nsresult rv = GetRect(rect);

  *aLeft = rect.x;

  return rv;
}

Here is the call graph for this function:

Definition at line 131 of file nsScreen.cpp.

{
  nsIDeviceContext* context = GetDeviceContext();

  if (!context) {
    *aPixelDepth = -1;

    return NS_ERROR_FAILURE;
  }

  PRUint32 depth;
  context->GetDepth(depth);

  *aPixelDepth = depth;

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsScreen::GetRect ( nsRect aRect) [protected]

Definition at line 223 of file nsScreen.cpp.

{
  nsIDeviceContext *context = GetDeviceContext();

  if (!context) {
    return NS_ERROR_FAILURE;
  }

  context->GetRect(aRect);

  float devUnits;
  devUnits = context->DevUnitsToAppUnits();

  aRect.x = NSToIntRound(float(aRect.x) / devUnits);
  aRect.y = NSToIntRound(float(aRect.y) / devUnits);

  context->GetDeviceSurfaceDimensions(aRect.width, aRect.height);

  aRect.height = NSToIntRound(float(aRect.height) / devUnits);
  aRect.width = NSToIntRound(float(aRect.width) / devUnits);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 85 of file nsScreen.cpp.

{
  nsRect rect;
  nsresult rv = GetRect(rect);

  *aTop = rect.y;

  return rv;
}

Here is the call graph for this function:

Definition at line 109 of file nsScreen.cpp.

{
  nsRect rect;
  nsresult rv = GetRect(rect);

  *aWidth = rect.width;

  return rv;
}

Here is the call graph for this function:

Definition at line 78 of file nsScreen.cpp.

{
   mDocShell = aDocShell; // Weak Reference
   return NS_OK;
}

Member Data Documentation

Definition at line 52 of file nsIDOMScreen.idl.

readonly attribute long nsIDOMScreen::availLeft [inherited]

Definition at line 53 of file nsIDOMScreen.idl.

readonly attribute long nsIDOMScreen::availTop [inherited]

Definition at line 54 of file nsIDOMScreen.idl.

readonly attribute long nsIDOMScreen::availWidth [inherited]

Definition at line 51 of file nsIDOMScreen.idl.

readonly attribute long nsIDOMScreen::colorDepth [inherited]

Definition at line 50 of file nsIDOMScreen.idl.

readonly attribute long nsIDOMScreen::height [inherited]

Definition at line 48 of file nsIDOMScreen.idl.

readonly attribute long nsIDOMScreen::left [inherited]

Definition at line 46 of file nsIDOMScreen.idl.

Definition at line 77 of file nsScreen.h.

readonly attribute long nsIDOMScreen::pixelDepth [inherited]

Definition at line 49 of file nsIDOMScreen.idl.

readonly attribute long nsIDOMScreen::top [inherited]

Definition at line 45 of file nsIDOMScreen.idl.

readonly attribute long nsIDOMScreen::width [inherited]

Definition at line 47 of file nsIDOMScreen.idl.


The documentation for this class was generated from the following files: