Back to index

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

#include <nsIDeviceContext.h>

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

List of all members.

Public Member Functions

NS_IMETHOD Init (nsNativeWidget aWidget)=0
 Initialize the device context from a widget.
NS_IMETHOD CreateRenderingContext (nsIView *aView, nsIRenderingContext *&aContext)=0
 Create a rendering context and initialize it from an nsIView.
NS_IMETHOD CreateRenderingContext (nsIDrawingSurface *aSurface, nsIRenderingContext *&aContext)=0
 Create a rendering context and initialize it from an nsIDrawingSurface*.
NS_IMETHOD CreateRenderingContext (nsIWidget *aWidget, nsIRenderingContext *&aContext)=0
 Create a rendering context and initialize it from an nsIWidget.
NS_IMETHOD CreateRenderingContext (nsIRenderingContext *&aContext)=0
 Create a rendering context and initialize it.
NS_IMETHOD CreateRenderingContextInstance (nsIRenderingContext *&aContext)=0
 Create an uninitalised rendering context.
NS_IMETHOD SupportsNativeWidgets (PRBool &aSupportsWidgets)=0
 Query the device to see if it supports native widgets.
float DevUnitsToTwips () const
 Obtain the size of a device unit relative to a Twip.
float TwipsToDevUnits () const
 Obtain the size of a Twip relative to a device unit.
void SetAppUnitsToDevUnits (float aAppUnits)
 Set the scale factor to convert units used by the application to device units.
void SetDevUnitsToAppUnits (float aDevUnits)
 Set the scale factor to convert device units to units used by the application.
float AppUnitsToDevUnits () const
 Get the scale factor to convert from application defined units to device units.
float DevUnitsToAppUnits () const
 Get the scale factor to convert from device units to application defined units.
NS_IMETHOD GetCanonicalPixelScale (float &aScale) const =0
 Get the value used to scale a "standard" pixel to a pixel of the same physical size for this device.
NS_IMETHOD SetCanonicalPixelScale (float aScale)=0
 Get the value used to scale a "standard" pixel to a pixel of the same physical size for this device.
NS_IMETHOD GetScrollBarDimensions (float &aWidth, float &aHeight) const =0
 Get the width of a vertical scroll bar and the height of a horizontal scrollbar in application units.
NS_IMETHOD GetSystemFont (nsSystemFontID aID, nsFont *aFont) const =0
 Fill in an nsFont based on the ID of a system font.
NS_IMETHOD GetMetricsFor (const nsFont &aFont, nsIAtom *aLangGroup, nsIFontMetrics *&aMetrics)=0
 Get the nsIFontMetrics that describe the properties of an nsFont.
NS_IMETHOD GetMetricsFor (const nsFont &aFont, nsIFontMetrics *&aMetrics)=0
 Get the nsIFontMetrics that describe the properties of an nsFont.
NS_IMETHOD SetZoom (float aZoom)=0
NS_IMETHOD GetZoom (float &aZoom) const =0
NS_IMETHOD CheckFontExistence (const nsString &aFaceName)=0
 Check to see if a particular named font exists.
NS_IMETHOD FirstExistingFont (const nsFont &aFont, nsString &aFaceName)=0
NS_IMETHOD GetLocalFontName (const nsString &aFaceName, nsString &aLocalName, PRBool &aAliased)=0
NS_IMETHOD FontMetricsDeleted (const nsIFontMetrics *aFontMetrics)=0
 Notification when a font metrics instance created for this device is about to be deleted.
NS_IMETHOD FlushFontCache (void)=0
 Attempt to free up resoruces by flushing out any fonts no longer referenced by anything other than the font cache itself.
NS_IMETHOD GetDepth (PRUint32 &aDepth)=0
 Return the bit depth of the device.
NS_IMETHOD GetPaletteInfo (nsPaletteInfo &aPaletteInfo)=0
 Returns information about the device's palette capabilities.
NS_IMETHOD GetDeviceSurfaceDimensions (PRInt32 &aWidth, PRInt32 &aHeight)=0
 Get the size of the displayable area of the output device in app units.
NS_IMETHOD GetRect (nsRect &aRect)=0
 Get the size of the content area of the output device in app units.
NS_IMETHOD GetClientRect (nsRect &aRect)=0
 Get the size of the content area of the output device in app units.
NS_IMETHOD GetDeviceContextFor (nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext)=0
 Returns a new nsIDeviceContext suitable for the device context specification passed in.
NS_IMETHOD PrepareDocument (PRUnichar *aTitle, PRUnichar *aPrintToFileName)=0
 This is enables the DeviceContext to anything it needs to do for Printing before Reflow and BeginDocument is where work can be done after reflow.
NS_IMETHOD BeginDocument (PRUnichar *aTitle, PRUnichar *aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage)=0
 Inform the output device that output of a document is beginning Used for print related device contexts.
NS_IMETHOD EndDocument (void)=0
 Inform the output device that output of a document is ending.
NS_IMETHOD AbortDocument (void)=0
 Inform the output device that output of a document is being aborted.
NS_IMETHOD BeginPage (void)=0
 Inform the output device that output of a page is beginning Used for print related device contexts.
NS_IMETHOD EndPage (void)=0
 Inform the output device that output of a page is ending Used for print related device contexts.

Protected Attributes

float mTwipsToPixels
float mPixelsToTwips
float mAppUnitsToDevUnits
float mDevUnitsToAppUnits

Detailed Description

Definition at line 214 of file nsIDeviceContext.h.


Member Function Documentation

Inform the output device that output of a document is being aborted.

Must be matched 1:1 with BeginDocument()

Returns:
error status

Implemented in NS_GFX.

float nsIDeviceContext::AppUnitsToDevUnits ( ) const [inline]

Get the scale factor to convert from application defined units to device units.

Parameters:
aAppUnitsscale value

Definition at line 320 of file nsIDeviceContext.h.

{ return mAppUnitsToDevUnits; }

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::BeginDocument ( PRUnichar aTitle,
PRUnichar aPrintToFileName,
PRInt32  aStartPage,
PRInt32  aEndPage 
) [pure virtual]

Inform the output device that output of a document is beginning Used for print related device contexts.

Must be matched 1:1 with EndDocument(). XXX needs to take parameters so that feedback can be given to the app regarding pagination progress and aborting print operations?

Parameters:
aTitle- itle of Document
aPrintToFileName- name of file to print to, if NULL then don't print to file
aStartPage- starting page number (must be greater than zero)
aEndPage- ending page number (must be less than or equal to number of pages)
Returns:
error status

Inform the output device that output of a page is beginning Used for print related device contexts.

Must be matched 1:1 with EndPage() and within a BeginDocument()/EndDocument() pair.

Returns:
error status

Here is the caller graph for this function:

Check to see if a particular named font exists.

Parameters:
aFontNamecharacter string of font face name
Returns:
NS_OK if font is available, else font is unavailable

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::CreateRenderingContext ( nsIView aView,
nsIRenderingContext *&  aContext 
) [pure virtual]

Create a rendering context and initialize it from an nsIView.

Parameters:
aViewview to initialize context from
aContextout parameter for new rendering context
Returns:
error status

Implemented in NS_GFX.

Here is the caller graph for this function:

Create a rendering context and initialize it from an nsIDrawingSurface*.

Parameters:
nsIDrawingSurface*widget to initialize context from
aContextout parameter for new rendering context
Returns:
error status

Implemented in NS_GFX.

NS_IMETHOD nsIDeviceContext::CreateRenderingContext ( nsIWidget aWidget,
nsIRenderingContext *&  aContext 
) [pure virtual]

Create a rendering context and initialize it from an nsIWidget.

Parameters:
aWidgetwidget to initialize context from
aContextout parameter for new rendering context
Returns:
error status

Implemented in NS_GFX.

Create a rendering context and initialize it.

This API should only be called on device contexts whose SupportsNativeWidgets() method return PR_FALSE.

Parameters:
aContextout parameter for new rendering context
Returns:
error status

Implemented in NS_GFX.

Create an uninitalised rendering context.

Parameters:
aContextout parameter for new rendering context
Returns:
error status

Implemented in NS_GFX.

Here is the caller graph for this function:

float nsIDeviceContext::DevUnitsToAppUnits ( ) const [inline]

Get the scale factor to convert from device units to application defined units.

Parameters:
aDevUnitsout paramater for scale value
Returns:
error status

Definition at line 328 of file nsIDeviceContext.h.

{ return mDevUnitsToAppUnits; }
float nsIDeviceContext::DevUnitsToTwips ( ) const [inline]

Obtain the size of a device unit relative to a Twip.

A twip is 1/20 of a point (which is 1/72 of an inch).

Returns:
conversion value

Definition at line 279 of file nsIDeviceContext.h.

{ return mPixelsToTwips; }

Here is the caller graph for this function:

Inform the output device that output of a document is ending.

Used for print related device contexts. Must be matched 1:1 with BeginDocument()

Returns:
error status

Inform the output device that output of a page is ending Used for print related device contexts.

Must be matched 1:1 with BeginPage() and within a BeginDocument()/EndDocument() pair.

Returns:
error status

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::FirstExistingFont ( const nsFont aFont,
nsString aFaceName 
) [pure virtual]

Implemented in NS_GFX.

Attempt to free up resoruces by flushing out any fonts no longer referenced by anything other than the font cache itself.

Returns:
error status

Implemented in NS_GFX.

Here is the caller graph for this function:

Notification when a font metrics instance created for this device is about to be deleted.

Implemented in NS_GFX, and NS_GFX.

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetCanonicalPixelScale ( float &  aScale) const [pure virtual]

Get the value used to scale a "standard" pixel to a pixel of the same physical size for this device.

a standard pixel is defined as a pixel on display 0. this is used to make sure that entities defined in pixel dimensions maintain a constant relative size when displayed from one output device to another.

Parameters:
aScaleout parameter for scale value
Returns:
error status

Implemented in NS_GFX.

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetClientRect ( nsRect aRect) [pure virtual]

Get the size of the content area of the output device in app units.

This corresponds on a screen device, for instance, to the area reported by GetDeviceSurfaceDimensions, minus the taskbar (Windows) or menubar (Macintosh).

Parameters:
aRectout parameter for client rect. Position (x,y) will be (0,0) adjusted for any upper/left non-client space if present or relative to the primary monitor if this is not the primary.
Returns:
error status

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetDepth ( PRUint32 aDepth) [pure virtual]

Return the bit depth of the device.

Implemented in NS_GFX.

Here is the caller graph for this function:

Returns a new nsIDeviceContext suitable for the device context specification passed in.

Parameters:
aDevicea device context specification. this is a platform specific structure that only a platform specific device context can interpret.
aContextout parameter for new device context. nsnull on failure to create new device context.
Returns:
error status
NS_IMETHOD nsIDeviceContext::GetDeviceSurfaceDimensions ( PRInt32 aWidth,
PRInt32 aHeight 
) [pure virtual]

Get the size of the displayable area of the output device in app units.

Parameters:
aWidthout parameter for width
aHeightout parameter for height
Returns:
error status

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetLocalFontName ( const nsString aFaceName,
nsString aLocalName,
PRBool aAliased 
) [pure virtual]

Implemented in NS_GFX.

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetMetricsFor ( const nsFont aFont,
nsIAtom aLangGroup,
nsIFontMetrics *&  aMetrics 
) [pure virtual]

Get the nsIFontMetrics that describe the properties of an nsFont.

Parameters:
aFontfont description to obtain metrics for
aLangGroupthe language group of the document
aMetricsout parameter for font metrics
Returns:
error status

Implemented in NS_GFX, and NS_GFX.

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetMetricsFor ( const nsFont aFont,
nsIFontMetrics *&  aMetrics 
) [pure virtual]

Get the nsIFontMetrics that describe the properties of an nsFont.

Parameters:
aFontfont description to obtain metrics for
aMetricsout parameter for font metrics
Returns:
error status

Implemented in NS_GFX.

NS_IMETHOD nsIDeviceContext::GetPaletteInfo ( nsPaletteInfo aPaletteInfo) [pure virtual]

Returns information about the device's palette capabilities.

Implemented in NS_GFX.

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetRect ( nsRect aRect) [pure virtual]

Get the size of the content area of the output device in app units.

This corresponds on a screen device, for instance, to the entire screen.

Parameters:
aRectout parameter for full rect. Position (x,y) will be (0,0) or relative to the primary monitor if this is not the primary.
Returns:
error status

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetScrollBarDimensions ( float &  aWidth,
float &  aHeight 
) const [pure virtual]

Get the width of a vertical scroll bar and the height of a horizontal scrollbar in application units.

Parameters:
aWidthout parameter for width
aHeightout parameter for height
Returns:
error status

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::GetSystemFont ( nsSystemFontID  aID,
nsFont aFont 
) const [pure virtual]

Fill in an nsFont based on the ID of a system font.

This function may or may not fill in the size, so the size should be set to a reasonable default before calling.

Parameters:
aIDThe system font ID.
aInfoThe font structure to be filled in.
Returns:
error status
NS_IMETHOD nsIDeviceContext::GetZoom ( float &  aZoom) const [pure virtual]

Implemented in NS_GFX.

NS_IMETHOD nsIDeviceContext::Init ( nsNativeWidget  aWidget) [pure virtual]

Initialize the device context from a widget.

Parameters:
aWidgeta native widget to initialize the device context from
Returns:
error status

Implemented in NS_GFX.

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::PrepareDocument ( PRUnichar aTitle,
PRUnichar aPrintToFileName 
) [pure virtual]

This is enables the DeviceContext to anything it needs to do for Printing before Reflow and BeginDocument is where work can be done after reflow.

Parameters:
aTitle- itle of Document
aPrintToFileName- name of file to print to, if NULL then don't print to file
Returns:
error status

Implemented in NS_GFX.

void nsIDeviceContext::SetAppUnitsToDevUnits ( float  aAppUnits) [inline]

Set the scale factor to convert units used by the application to device units.

Typically, an application will query the device for twips to device units scale and then set the scale to convert from whatever unit the application wants to use to device units. From that point on, all other parts of the app can use the Get* methods below to figure out how to convert device units <-> app units.

Parameters:
aAppUnitsscale value to convert from application defined units to device units.

Definition at line 298 of file nsIDeviceContext.h.

  {
    mAppUnitsToDevUnits = aAppUnits;
  }

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::SetCanonicalPixelScale ( float  aScale) [pure virtual]

Get the value used to scale a "standard" pixel to a pixel of the same physical size for this device.

a standard pixel is defined as a pixel on display 0. this is used to make sure that entities defined in pixel dimensions maintain a constant relative size when displayed from one output device to another.

Parameters:
aScalein parameter for scale value
Returns:
error status

Implemented in NS_GFX.

Here is the caller graph for this function:

void nsIDeviceContext::SetDevUnitsToAppUnits ( float  aDevUnits) [inline]

Set the scale factor to convert device units to units used by the application.

This should generally be 1.0f / the value passed into SetAppUnitsToDevUnits().

Parameters:
aDevUnitsscale value to convert from device units to application defined units

Definition at line 310 of file nsIDeviceContext.h.

  {
    mDevUnitsToAppUnits = aDevUnits;
  }

Here is the caller graph for this function:

NS_IMETHOD nsIDeviceContext::SetZoom ( float  aZoom) [pure virtual]

Implemented in NS_GFX.

NS_IMETHOD nsIDeviceContext::SupportsNativeWidgets ( PRBool aSupportsWidgets) [pure virtual]

Query the device to see if it supports native widgets.

If not, then nsIWidget->Create() calls should be avoided.

Parameters:
aSupportsWidgetsout paramater. If PR_TRUE, then native widgets can be created.
Returns:
error status

Here is the caller graph for this function:

float nsIDeviceContext::TwipsToDevUnits ( ) const [inline]

Obtain the size of a Twip relative to a device unit.

Returns:
conversion value

Definition at line 285 of file nsIDeviceContext.h.

{ return mTwipsToPixels; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 560 of file nsIDeviceContext.h.

Definition at line 561 of file nsIDeviceContext.h.

Definition at line 559 of file nsIDeviceContext.h.

Definition at line 558 of file nsIDeviceContext.h.


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