Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsDeviceContextOS2.cpp File Reference
#include "nsDeviceContextOS2.h"
#include "nsRenderingContextOS2.h"
#include "nsDeviceContextSpecOS2.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
#include "nsIScreenManager.h"
#include "nsIScreen.h"
#include "nsHashTable.h"
#include "nsGfxDefs.h"
#include "nsIPref.h"
#include "nsOS2Uni.h"
#include "nsPaletteOS2.h"

Go to the source code of this file.


#define NOT_SETUP   0x33


nscolor GetSysColorInfo (int iSysColor)
void QueryFontFromINI (char *fontType, char *fontName, ULONG ulLength)
nsresult GetSysFontInfo (nsSystemFontID aID, nsFont *aFont)
int prefChanged (const char *aPref, void *aClosure)


static PRBool gIsWarp4 = NOT_SETUP

Define Documentation

#define NOT_SETUP   0x33

Definition at line 57 of file nsDeviceContextOS2.cpp.

Function Documentation

nscolor GetSysColorInfo ( int  iSysColor)

Definition at line 360 of file nsDeviceContextOS2.cpp.

  long lColor = ::WinQuerySysColor( HWND_DESKTOP, iSysColor, 0);
  RGB2 *pRGB2 = (RGB2*) &lColor;
  return NS_RGB( pRGB2->bRed, pRGB2->bGreen, pRGB2->bBlue);

Here is the call graph for this function:

nsresult GetSysFontInfo ( nsSystemFontID  aID,
nsFont aFont 

Definition at line 400 of file nsDeviceContextOS2.cpp.

  char szFontNameSize[MAXNAMEL];

  switch (aID)
    case eSystemFont_Icon: 
      QueryFontFromINI("IconText", szFontNameSize, MAXNAMEL);

    case eSystemFont_Menu: 
      QueryFontFromINI("Menus", szFontNameSize, MAXNAMEL);

    case eSystemFont_Caption: 

    case eSystemFont_MessageBox: 

    case eSystemFont_SmallCaption: 

    case eSystemFont_StatusBar: 
    case eSystemFont_Tooltips: 

    case eSystemFont_Widget:

    case eSystemFont_Window:      // css3
    case eSystemFont_Document:
    case eSystemFont_Workspace:
    case eSystemFont_Desktop:
    case eSystemFont_Info:
    case eSystemFont_Dialog:
    case eSystemFont_Button:
    case eSystemFont_PullDownMenu:
    case eSystemFont_List:
    case eSystemFont_Field:
      QueryFontFromINI("WindowText", szFontNameSize, MAXNAMEL);
  } // switch 

  int pointSize;
  char *szFacename;

  pointSize = atoi(szFontNameSize);
  szFacename = strchr(szFontNameSize, '.');

  if ((pointSize == 0) || (!szFacename) || (*(szFacename++) == '\0')) {
     return NS_ERROR_FAILURE;

#ifdef OLDCODE
  PRUnichar name[FACESIZE];
  name[0] = 0;
  MultiByteToWideChar(0, szFacename,
                      strlen(szFacename) + 1, name, sizeof(name)/sizeof(name[0]));

  // Do Style
  aFont->style = NS_FONT_STYLE_NORMAL;
#if 0
  if (ptrLogFont->lfItalic)
    aFont->style = NS_FONT_STYLE_ITALIC;
  // XXX What about oblique?

  aFont->variant = NS_FONT_VARIANT_NORMAL;

  // Do Weight
#if 0
  aFont->weight = (ptrLogFont->lfWeight == FW_BOLD ? 
  aFont->weight = NS_FONT_WEIGHT_NORMAL;

  // Do decorations
  aFont->decorations = NS_FONT_DECORATION_NONE;
#if 0
  if (ptrLogFont->lfUnderline)
    aFont->decorations |= NS_FONT_DECORATION_UNDERLINE;
  if (ptrLogFont->lfStrikeOut)
    aFont->decorations |= NS_FONT_DECORATION_LINE_THROUGH;

  // Do Size
  aFont->size = NSIntPointsToTwips(pointSize);

  aFont->systemFont = PR_TRUE;

  return NS_OK;

Here is the call graph for this function:

Here is the caller graph for this function:

int prefChanged ( const char *  aPref,
void aClosure 

Definition at line 600 of file nsDeviceContextOS2.cpp.

  nsDeviceContextOS2 *context = (nsDeviceContextOS2*)aClosure;
  nsresult rv;
  if (nsCRT::strcmp(aPref, "layout.css.dpi")==0) {
    PRInt32 dpi;
    nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
    rv = prefs->GetIntPref(aPref, &dpi);
    if (NS_SUCCEEDED(rv))

  return 0;

Here is the call graph for this function:

Here is the caller graph for this function:

void QueryFontFromINI ( char *  fontType,
char *  fontName,
ULONG  ulLength 

Definition at line 369 of file nsDeviceContextOS2.cpp.

  ULONG ulMaxNameL = ulLength;

  /* We had to switch to using PrfQueryProfileData because */
  /* some users have binary font data in their INI files */
  BOOL rc = PrfQueryProfileData(HINI_USER, "PM_SystemFonts", fontType,
                                fontName, &ulMaxNameL);
  /* If there was no entry in the INI, default to something */
  if (rc == FALSE) {
    /* Different values for DBCS vs. SBCS */
    if (!IsDBCS()) {
      /* WarpSans is only available on Warp 4 and above */
      if (gIsWarp4)
        strcpy(fontName, "9.WarpSans");
        strcpy(fontName, "8.Helv");
    } else {
      /* WarpSans is only available on Warp 4 and above */
      if (gIsWarp4)
        strcpy(fontName, "9.WarpSans Combined");
        strcpy(fontName, "10.Helv Combined");
  } else {
    /* null terminate fontname */
    fontName[ulMaxNameL] = '\0';

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

Definition at line 58 of file nsDeviceContextOS2.cpp.