Back to index

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

A singleton instance of nsSystemFontsGTK is created by the first device context and destroyed by the module destructor. More...

List of all members.

Public Member Functions

 nsSystemFontsGTK (float aPixelsToTwips)
const nsFontGetDefaultFont ()
const nsFontGetMenuFont ()
const nsFontGetFieldFont ()
const nsFontGetButtonFont ()
 nsSystemFontsGTK (float aPixelsToTwips)
const nsFontGetDefaultFont ()
const nsFontGetMenuFont ()
const nsFontGetFieldFont ()
const nsFontGetButtonFont ()

Private Member Functions

nsresult GetSystemFontInfo (GtkWidget *aWidget, nsFont *aFont, float aPixelsToTwips) const
nsresult GetSystemFontInfo (GtkWidget *aWidget, nsFont *aFont, float aPixelsToTwips) const

Private Attributes

nsFont mDefaultFont
nsFont mButtonFont
nsFont mFieldFont
nsFont mMenuFont

Detailed Description

A singleton instance of nsSystemFontsGTK is created by the first device context and destroyed by the module destructor.

Definition at line 61 of file nsCairoDeviceContext.cpp.


Constructor & Destructor Documentation

nsSystemFontsGTK::nsSystemFontsGTK ( float  aPixelsToTwips)

Definition at line 506 of file nsCairoDeviceContext.cpp.

  : mDefaultFont("sans-serif", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
                 NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE,
                 DEFAULT_TWIP_FONT_SIZE),
    mButtonFont("sans-serif", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
                NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE,
                DEFAULT_TWIP_FONT_SIZE),
    mFieldFont("sans-serif", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
               NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE,
               DEFAULT_TWIP_FONT_SIZE),
    mMenuFont("sans-serif", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
               NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE,
               DEFAULT_TWIP_FONT_SIZE)
{
  /*
   * Much of the widget creation code here is similar to the code in
   * nsLookAndFeel::InitColors().
   */

  // mDefaultFont
  GtkWidget *label = gtk_label_new("M");
  GtkWidget *parent = gtk_fixed_new();
  GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);

  gtk_container_add(GTK_CONTAINER(parent), label);
  gtk_container_add(GTK_CONTAINER(window), parent);

  gtk_widget_ensure_style(label);

  GetSystemFontInfo(label, &mDefaultFont, aPixelsToTwips);

  gtk_widget_destroy(window);  // no unref, windows are different

  // mFieldFont
  GtkWidget *entry = gtk_entry_new();
  parent = gtk_fixed_new();
  window = gtk_window_new(GTK_WINDOW_POPUP);

  gtk_container_add(GTK_CONTAINER(parent), entry);
  gtk_container_add(GTK_CONTAINER(window), parent);
  gtk_widget_ensure_style(entry);

  GetSystemFontInfo(entry, &mFieldFont, aPixelsToTwips);

  gtk_widget_destroy(window);  // no unref, windows are different

  // mMenuFont
  GtkWidget *accel_label = gtk_accel_label_new("M");
  GtkWidget *menuitem = gtk_menu_item_new();
  GtkWidget *menu = gtk_menu_new();
  gtk_object_ref(GTK_OBJECT(menu));
  gtk_object_sink(GTK_OBJECT(menu));

  gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
  gtk_menu_append(GTK_MENU(menu), menuitem);

  gtk_widget_ensure_style(accel_label);

  GetSystemFontInfo(accel_label, &mMenuFont, aPixelsToTwips);

  gtk_widget_unref(menu);

  // mButtonFont
  parent = gtk_fixed_new();
  GtkWidget *button = gtk_button_new();
  label = gtk_label_new("M");
  window = gtk_window_new(GTK_WINDOW_POPUP);
          
  gtk_container_add(GTK_CONTAINER(button), label);
  gtk_container_add(GTK_CONTAINER(parent), button);
  gtk_container_add(GTK_CONTAINER(window), parent);

  gtk_widget_ensure_style(label);

  GetSystemFontInfo(label, &mButtonFont, aPixelsToTwips);

  gtk_widget_destroy(window);  // no unref, windows are different

}

Here is the call graph for this function:

nsSystemFontsGTK::nsSystemFontsGTK ( float  aPixelsToTwips)

Member Function Documentation

Definition at line 69 of file nsCairoDeviceContext.cpp.

{ return mButtonFont; }

Here is the caller graph for this function:

Definition at line 110 of file nsDeviceContextGTK.cpp.

{ return mButtonFont; }

Definition at line 66 of file nsCairoDeviceContext.cpp.

{ return mDefaultFont; }

Here is the caller graph for this function:

Definition at line 107 of file nsDeviceContextGTK.cpp.

{ return mDefaultFont; }

Definition at line 68 of file nsCairoDeviceContext.cpp.

{ return mFieldFont; }

Here is the caller graph for this function:

Definition at line 109 of file nsDeviceContextGTK.cpp.

{ return mFieldFont; }

Definition at line 67 of file nsCairoDeviceContext.cpp.

{ return mMenuFont; }

Here is the caller graph for this function:

Definition at line 108 of file nsDeviceContextGTK.cpp.

{ return mMenuFont; }
nsresult nsSystemFontsGTK::GetSystemFontInfo ( GtkWidget *  aWidget,
nsFont aFont,
float  aPixelsToTwips 
) const [private]

Here is the caller graph for this function:

nsresult nsSystemFontsGTK::GetSystemFontInfo ( GtkWidget *  aWidget,
nsFont aFont,
float  aPixelsToTwips 
) const [private]

Member Data Documentation

Definition at line 92 of file nsCairoDeviceContext.cpp.

Definition at line 91 of file nsCairoDeviceContext.cpp.

Definition at line 93 of file nsCairoDeviceContext.cpp.

Definition at line 94 of file nsCairoDeviceContext.cpp.


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