Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsXPLookAndFeel.cpp File Reference
#include "nscore.h"
#include "nsXPLookAndFeel.h"
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nsCRT.h"
#include "nsFont.h"

Go to the source code of this file.

Functions

static int PR_CALLBACK colorPrefChanged (const char *aPref, void *aData)
static NS_DEFINE_CID (kPrefServiceCID, NS_PREF_CID)
static int PR_CALLBACK intPrefChanged (const char *newpref, void *data)
static int PR_CALLBACK floatPrefChanged (const char *newpref, void *data)

Function Documentation

static int PR_CALLBACK colorPrefChanged ( const char *  aPref,
void aData 
) [static]

Definition at line 262 of file nsXPLookAndFeel.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIPref> prefService(do_GetService(kPrefServiceCID, &rv));
  if (NS_SUCCEEDED(rv) && prefService) {
    nsXPIDLCString colorStr;
    rv = prefService->CopyCharPref(newpref, getter_Copies(colorStr));
    if (NS_SUCCEEDED(rv) && colorStr[0]) {
      nscolor thecolor;
      if (colorStr[0] == '#') {
        if (NS_SUCCEEDED(NS_HexToRGB(NS_ConvertASCIItoUCS2(Substring(colorStr, 1, colorStr.Length() - 1)),
                                     &thecolor))) {
          PRInt32 id = NS_PTR_TO_INT32(data);
          CACHE_COLOR(id, thecolor);
        }
      }
      else if (NS_SUCCEEDED(NS_ColorNameToRGB(NS_ConvertASCIItoUCS2(colorStr),
                                         &thecolor))) {
        PRInt32 id = NS_PTR_TO_INT32(data);
        CACHE_COLOR(id, thecolor);
#ifdef DEBUG_akkana
        printf("====== Changed color pref %s to 0x%lx\n",
               newpref, thecolor);
#endif
      }
    }
  }
  return 0;
}

Here is the call graph for this function:

static int PR_CALLBACK floatPrefChanged ( const char *  newpref,
void data 
) [static]

Definition at line 238 of file nsXPLookAndFeel.cpp.

{
  nsLookAndFeelFloatPref* np = (nsLookAndFeelFloatPref*)data;
  if (np)
  {
    nsresult rv;
    nsCOMPtr<nsIPref> prefService(do_GetService(kPrefServiceCID, &rv));
    if (NS_SUCCEEDED(rv) && prefService)
    {
      PRInt32 intpref;
      rv = prefService->GetIntPref(np->name, &intpref);
      if (NS_SUCCEEDED(rv))
      {
        np->floatVar = (float)intpref / 100.;
        np->isSet = PR_TRUE;
#ifdef DEBUG_akkana
        printf("====== Changed float pref %s to %f\n", np->name, np->floatVar);
#endif
      }
    }
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int PR_CALLBACK intPrefChanged ( const char *  newpref,
void data 
) [static]

Definition at line 214 of file nsXPLookAndFeel.cpp.

{
  nsLookAndFeelIntPref* np = (nsLookAndFeelIntPref*)data;
  if (np)
  {
    nsresult rv;
    nsCOMPtr<nsIPref> prefService(do_GetService(kPrefServiceCID, &rv));
    if (NS_SUCCEEDED(rv) && prefService)
    {
      PRInt32 intpref;
      rv = prefService->GetIntPref(np->name, &intpref);
      if (NS_SUCCEEDED(rv))
      {
        np->intVar = intpref;
        np->isSet = PR_TRUE;
#ifdef DEBUG_akkana
        printf("====== Changed int pref %s to %d\n", np->name, np->intVar);
#endif
      }
    }
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kPrefServiceCID  ,
NS_PREF_CID   
) [static]