Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsCairoDeviceContext Class Reference

#include <nsCairoDeviceContext.h>

Collaboration diagram for nsCairoDeviceContext:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsCairoDeviceContext ()
virtual ~nsCairoDeviceContext ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
Init (nsNativeWidget aWidget)
NS_IMETHOD CreateRenderingContext (nsIView *aView, nsIRenderingContext *&aContext)
NS_IMETHOD CreateRenderingContext (nsIDrawingSurface *aSurface, nsIRenderingContext *&aContext)
NS_IMETHOD CreateRenderingContext (nsIWidget *aWidget, nsIRenderingContext *&aContext)
NS_IMETHOD CreateRenderingContext (nsIRenderingContext *&aContext)
NS_IMETHOD CreateRenderingContextInstance (nsIRenderingContext *&aContext)
NS_IMETHOD SupportsNativeWidgets (PRBool &aSupportsWidgets)
NS_IMETHOD GetScrollBarDimensions (float &aWidth, float &aHeight) const
NS_IMETHOD GetSystemFont (nsSystemFontID aID, nsFont *aFont) const
NS_IMETHOD CheckFontExistence (const nsString &aFaceName)
NS_IMETHOD GetDepth (PRUint32 &aDepth)
NS_IMETHOD GetPaletteInfo (nsPaletteInfo &aPaletteInfo)
NS_IMETHOD ConvertPixel (nscolor aColor, PRUint32 &aPixel)
NS_IMETHOD GetDeviceSurfaceDimensions (PRInt32 &aWidth, PRInt32 &aHeight)
NS_IMETHOD GetRect (nsRect &aRect)
NS_IMETHOD GetClientRect (nsRect &aRect)
NS_IMETHOD GetDeviceContextFor (nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext)
NS_IMETHOD PrepareDocument (PRUnichar *aTitle, PRUnichar *aPrintToFileName)
NS_IMETHOD BeginDocument (PRUnichar *aTitle, PRUnichar *aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage)
NS_IMETHOD EndDocument (void)
NS_IMETHOD AbortDocument (void)
NS_IMETHOD BeginPage (void)
NS_IMETHOD EndPage (void)
NS_IMETHOD SetAltDevice (nsIDeviceContext *aAltDC)
NS_IMETHOD GetAltDevice (nsIDeviceContext **aAltDC)
NS_IMETHOD SetUseAltDC (PRUint8 aValue, PRBool aOn)

Private Attributes

nsNativeWidget mWidget
nsCOMPtr< nsIScreenManagermScreenManager
float mWidthFloat
float mHeightFloat
PRInt32 mWidth
PRInt32 mHeight

Detailed Description

Definition at line 61 of file nsCairoDeviceContext.h.


Constructor & Destructor Documentation

Definition at line 102 of file nsCairoDeviceContext.cpp.

{
    NS_INIT_ISUPPORTS();

    mDevUnitsToAppUnits = 1.0f;
    mAppUnitsToDevUnits = 1.0f;
    mCPixelScale = 1.0f;
    mZoom = 1.0f;

#ifdef MOZ_ENABLE_XLIB
    mXlibRgbHandle = xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE);
#endif
}

Here is the call graph for this function:

Definition at line 116 of file nsCairoDeviceContext.cpp.

{
}

Member Function Documentation

Definition at line 430 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}
NS_IMETHODIMP nsCairoDeviceContext::BeginDocument ( PRUnichar aTitle,
PRUnichar aPrintToFileName,
PRInt32  aStartPage,
PRInt32  aEndPage 
)

Definition at line 413 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}

Definition at line 437 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}

Definition at line 297 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}

Definition at line 322 of file nsCairoDeviceContext.cpp.

{
    aPixel = aColor;
    return NS_OK;
}

Definition at line 165 of file nsCairoDeviceContext.cpp.

{
    NS_ENSURE_ARG_POINTER(aView);
    NS_PRECONDITION(aView->HasWidget(), "View has no widget!");

    nsCOMPtr<nsIWidget> widget;
    widget = aView->GetWidget();

    return CreateRenderingContext(widget, aContext);
}

Here is the call graph for this function:

Definition at line 178 of file nsCairoDeviceContext.cpp.

{
    nsresult rv;

    aContext = nsnull;
    nsCOMPtr<nsIRenderingContext> pContext;
    rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
    if (NS_SUCCEEDED(rv)) {
        rv = pContext->Init(this, aSurface);
        if (NS_SUCCEEDED(rv)) {
            aContext = pContext;
            NS_ADDREF(aContext);
        }
    }

    return rv;
}

Here is the call graph for this function:

Definition at line 198 of file nsCairoDeviceContext.cpp.

{
    nsresult rv;

    aContext = nsnull;
    nsCOMPtr<nsIRenderingContext> pContext;
    rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
    if (NS_SUCCEEDED(rv)) {
        rv = pContext->Init(this, aWidget);
        if (NS_SUCCEEDED(rv)) {
            aContext = pContext;
            NS_ADDREF(aContext);
        }
    }

    return rv;
}

Here is the call graph for this function:

Definition at line 218 of file nsCairoDeviceContext.cpp.

{
    NS_ERROR("CreateRenderingContext with other rendering context arg; fix this if this needs to be called");
    return NS_OK;
}

Definition at line 225 of file nsCairoDeviceContext.cpp.

{
    nsCOMPtr<nsIRenderingContext> renderingContext = new nsCairoRenderingContext();
    if (!renderingContext)
        return NS_ERROR_OUT_OF_MEMORY;

    aContext = renderingContext;
    NS_ADDREF(aContext);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 423 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}

Definition at line 444 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}

Definition at line 458 of file nsCairoDeviceContext.cpp.

{
    *aAltDC = nsnull;
    return NS_OK;
}

Definition at line 385 of file nsCairoDeviceContext.cpp.

{
    fprintf (stderr, "+++ GetClientRect: ");
    nsresult rv = this->GetRect(aRect);
    return rv;
}

Here is the call graph for this function:

Definition at line 303 of file nsCairoDeviceContext.cpp.

{
    aDepth = 24;
    return NS_OK;
}

Definition at line 396 of file nsCairoDeviceContext.cpp.

{
    /* we don't do printing */
    return NS_ERROR_NOT_IMPLEMENTED;
}

Definition at line 330 of file nsCairoDeviceContext.cpp.

{
    if (mWidth == -1)
        mWidth = NSToIntRound(mWidthFloat * mDevUnitsToAppUnits);

    if (mHeight == -1)
        mHeight = NSToIntRound(mHeightFloat * mDevUnitsToAppUnits);

    aWidth = mWidth;
    aHeight = mHeight;

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 311 of file nsCairoDeviceContext.cpp.

{
    aPaletteInfo.isPaletteDevice = PR_FALSE;
    aPaletteInfo.sizePalette = 0;
    aPaletteInfo.numReserved = 0;
    aPaletteInfo.palette = nsnull;
    return NS_OK;
}

Definition at line 346 of file nsCairoDeviceContext.cpp.

{
#if defined (MOZ_ENABLE_GTK2) || defined (MOZ_ENABLE_XLIB)
    if (mWidget) {
        Window root_ignore;
        int x, y;
        unsigned int bwidth_ignore, width, height, depth;

        XGetGeometry(GDK_WINDOW_XDISPLAY(GDK_DRAWABLE(mWidget)),
                     GDK_WINDOW_XWINDOW(GDK_DRAWABLE(mWidget)),
                     &root_ignore, &x, &y,
                     &width, &height,
                     &bwidth_ignore, &depth);

        nsCOMPtr<nsIScreen> screen;
        mScreenManager->ScreenForRect(x, y, width, height, getter_AddRefs(screen));
        screen->GetRect(&aRect.x, &aRect.y, &aRect.width, &aRect.height);

        aRect.x = NSToIntRound(mDevUnitsToAppUnits * aRect.x);
        aRect.y = NSToIntRound(mDevUnitsToAppUnits * aRect.y);
        aRect.width = NSToIntRound(mDevUnitsToAppUnits * aRect.width);
        aRect.height = NSToIntRound(mDevUnitsToAppUnits * aRect.height);
    } else {
        aRect.x = 0;
        aRect.y = 0;

        this->GetDeviceSurfaceDimensions(aRect.width, aRect.height);
    }
#else
#error write me
#endif

    fprintf (stderr, "+++ GetRect: %d %d %d %d\n", aRect.x, aRect.y, aRect.width, aRect.height);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsCairoDeviceContext::GetScrollBarDimensions ( float &  aWidth,
float &  aHeight 
) const

Definition at line 245 of file nsCairoDeviceContext.cpp.

{
    aWidth = 10.0f * mPixelsToTwips;
    aHeight = 10.0f * mPixelsToTwips;
    return NS_OK;
}

Definition at line 253 of file nsCairoDeviceContext.cpp.

{
    nsresult status = NS_OK;

    if (!gSystemFonts) {
        gSystemFonts = new nsSystemFontsGTK(mPixelsToTwips);
    }

    switch (aID) {
    case eSystemFont_Menu:         // css2
    case eSystemFont_PullDownMenu: // css3
        *aFont = gSystemFonts->GetMenuFont();
        break;

    case eSystemFont_Field:        // css3
    case eSystemFont_List:         // css3
        *aFont = gSystemFonts->GetFieldFont();
        break;

    case eSystemFont_Button:       // css3
        *aFont = gSystemFonts->GetButtonFont();
        break;

    case eSystemFont_Caption:      // css2
    case eSystemFont_Icon:         // css2
    case eSystemFont_MessageBox:   // css2
    case eSystemFont_SmallCaption: // css2
    case eSystemFont_StatusBar:    // css2
    case eSystemFont_Window:       // css3
    case eSystemFont_Document:     // css3
    case eSystemFont_Workspace:    // css3
    case eSystemFont_Desktop:      // css3
    case eSystemFont_Info:         // css3
    case eSystemFont_Dialog:       // css3
    case eSystemFont_Tooltips:     // moz
    case eSystemFont_Widget:       // moz
        *aFont = gSystemFonts->GetDefaultFont();
        break;
    }

    return status;
}

Here is the call graph for this function:

Definition at line 129 of file nsCairoDeviceContext.cpp.

{
    //DeviceContextImpl::CommonInit();

    mTwipsToPixels = 96 / (float)NSIntPointsToTwips(72);
    mPixelsToTwips = 1.0f / mTwipsToPixels;

    mWidget = aWidget;

    if (!mScreenManager)
        mScreenManager = do_GetService("@mozilla.org/gfx/screenmanager;1");
    if (!mScreenManager)
        return NS_ERROR_FAILURE;

    nsCOMPtr<nsIScreen> screen;
    mScreenManager->GetPrimaryScreen (getter_AddRefs(screen));
    if (screen) {
        PRInt32 x, y, width, height;
        screen->GetRect (&x, &y, &width, &height );
        mWidthFloat = float(width);
        mHeightFloat = float(height);
    }

    if (getenv ("MOZ_X_SYNC")) {
        fprintf (stderr, "+++ Enabling XSynchronize\n");
        XSynchronize (gdk_x11_get_default_xdisplay(), True);
        XSetErrorHandler (helpful_error_handler);
    }

    mWidth = -1;
    mHeight = -1;

    return NS_OK;
}

Here is the call graph for this function:

Definition at line 405 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}

Definition at line 451 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}

Definition at line 466 of file nsCairoDeviceContext.cpp.

{
    return NS_OK;
}

Definition at line 238 of file nsCairoDeviceContext.cpp.

{
    aSupportsWidgets = PR_TRUE;
    return NS_OK;
}

Member Data Documentation

Definition at line 129 of file nsCairoDeviceContext.h.

Definition at line 127 of file nsCairoDeviceContext.h.

Definition at line 124 of file nsCairoDeviceContext.h.

Definition at line 122 of file nsCairoDeviceContext.h.

Definition at line 128 of file nsCairoDeviceContext.h.

Definition at line 126 of file nsCairoDeviceContext.h.


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