Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions
nsGtkUtils Struct Reference

#include <nsGtkUtils.h>

List of all members.

Static Public Member Functions

static void gtk_widget_set_color (GtkWidget *widget, GtkRcFlags flags, GtkStateType state, GdkColor *color)
static GdkModifierType gdk_keyboard_get_modifiers ()
 Return the current keyboard modifier state.
static void gdk_window_flash (GdkWindow *aGdkWindow, unsigned int aTimes, unsigned long aInterval, GdkRegion *aArea)
 Flash an area within a GDK window (or the whole window)

Detailed Description

Definition at line 43 of file nsGtkUtils.h.


Member Function Documentation

GdkModifierType nsGtkUtils::gdk_keyboard_get_modifiers ( ) [static]

Return the current keyboard modifier state.

Returns:
the current keyboard modifier state.

Definition at line 146 of file nsGtkUtils.cpp.

{
  GdkModifierType m = (GdkModifierType) 0;

  gdk_window_get_pointer(NULL,NULL,NULL,&m);

  return m;
}
void nsGtkUtils::gdk_window_flash ( GdkWindow *  aGdkWindow,
unsigned int  aTimes,
unsigned long  aInterval,
GdkRegion *  aArea 
) [static]

Flash an area within a GDK window (or the whole window)

Parameters:
aGdkWindowThe GDK window to flash.
aTimesNumber of times to flash the area.
aIntervalInterval between flashes in milliseconds.
aAreaThe area to flash. The whole window if NULL.

Definition at line 156 of file nsGtkUtils.cpp.

{
  gint         x;
  gint         y;
  gint         width;
  gint         height;
  guint        i;
  GdkGC *      gc = 0;
  GdkColor     white;

  gdk_window_get_geometry(aGdkWindow,
                          NULL,
                          NULL,
                          &width,
                          &height,
                          NULL);

  gdk_window_get_origin (aGdkWindow,
                         &x,
                         &y);

  gc = gdk_gc_new(GDK_ROOT_PARENT());

  white.pixel = WhitePixel(gdk_display,DefaultScreen(gdk_display));

  gdk_gc_set_foreground(gc,&white);
  gdk_gc_set_function(gc,GDK_XOR);
  gdk_gc_set_subwindow(gc,GDK_INCLUDE_INFERIORS);
  
  gdk_region_offset(aRegion, x, y);
  gdk_gc_set_clip_region(gc, aRegion);

  /*
   * Need to do this twice so that the XOR effect can replace 
   * the original window contents.
   */
  for (i = 0; i < aTimes * 2; i++)
  {
    gdk_draw_rectangle(GDK_ROOT_PARENT(),
                       gc,
                       TRUE,
                       x,
                       y,
                       width,
                       height);

    gdk_flush();
    
    usleep(aInterval);
  }

  gdk_gc_destroy(gc);

  gdk_region_offset(aRegion, -x, -y);
}

Here is the caller graph for this function:

void nsGtkUtils::gtk_widget_set_color ( GtkWidget *  widget,
GtkRcFlags  flags,
GtkStateType  state,
GdkColor *  color 
) [static]

Definition at line 96 of file nsGtkUtils.cpp.

{
  GtkRcStyle * rc_style;

  g_return_if_fail (widget != NULL);
  g_return_if_fail (GTK_IS_WIDGET (widget));
  g_return_if_fail (color != NULL);
  g_return_if_fail (flags == 0);

  rc_style = (GtkRcStyle *) gtk_object_get_data (GTK_OBJECT (widget), 
                                                                                     "modify-style");

  if (!rc_style)
  {
       rc_style = gtk_rc_style_new ();

       gtk_widget_modify_style (widget, rc_style);

       gtk_object_set_data (GTK_OBJECT (widget), "modify-style", rc_style);
  }

  if (flags & GTK_RC_FG)
  {
    rc_style->color_flags[state] = GtkRcFlags(rc_style->color_flags[state] | GTK_RC_FG);
    rc_style->fg[state] = *color;
  }

  if (flags & GTK_RC_BG)
  {
    rc_style->color_flags[state] = GtkRcFlags(rc_style->color_flags[state] | GTK_RC_BG);
    rc_style->bg[state] = *color;
  }

  if (flags & GTK_RC_TEXT)
  {
    rc_style->color_flags[state] = GtkRcFlags(rc_style->color_flags[state] | GTK_RC_TEXT);
    rc_style->text[state] = *color;
  }

  if (flags & GTK_RC_BASE)
  {
    rc_style->color_flags[state] = GtkRcFlags(rc_style->color_flags[state] | GTK_RC_BASE);
    rc_style->base[state] = *color;
  }
}

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