Back to index

gcompris  8.2.2
Defines | Functions
gtans_support.h File Reference
#include <gtk/gtk.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define get_widget   lookup_widget


GtkWidget * lookup_widget (GtkWidget *widget, const gchar *widget_name)
void add_pixmap_directory (const gchar *directory)
GtkWidget * create_pixmap (GtkWidget *widget, const gchar *filename)

Define Documentation

#define get_widget   lookup_widget

Definition at line 25 of file gtans_support.h.

Function Documentation

void add_pixmap_directory ( const gchar *  directory)

Definition at line 82 of file gtans_support.c.

  pixmaps_directories = g_list_prepend (pixmaps_directories,
                                        g_strdup (directory));
GtkWidget* create_pixmap ( GtkWidget *  widget,
const gchar *  filename 

Definition at line 90 of file gtans_support.c.

  gchar *found_filename = NULL;
  GdkColormap *colormap;
  GdkPixmap *gdkpixmap;
  GdkBitmap *mask;
  GtkWidget *pixmap;
  GList *elem;

  /* We first try any pixmaps directories set by the application. */
  elem = pixmaps_directories;
  while (elem)
      found_filename = check_file_exists ((gchar*)elem->data, filename);
      if (found_filename)
      elem = elem->next;

  /* If we haven't found the pixmap, try the source directory. */
  if (!found_filename)
      found_filename = check_file_exists ("../pixmaps", filename);

  if (!found_filename)
      g_warning ("Couldn't find pixmap file: %s", filename);
      return create_dummy_pixmap (widget);

  colormap = gtk_widget_get_colormap (widget);
  gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
                                                   NULL, found_filename);
  if (gdkpixmap == NULL)
      g_warning ("Error loading pixmap file: %s", found_filename);
      g_free (found_filename);
      return create_dummy_pixmap (widget);
  g_free (found_filename);
  pixmap = gtk_pixmap_new (gdkpixmap, mask);
  gdk_pixmap_unref (gdkpixmap);
  gdk_bitmap_unref (mask);
  return pixmap;

Here is the call graph for this function:

GtkWidget* lookup_widget ( GtkWidget *  widget,
const gchar *  widget_name 

Definition at line 26 of file gtans_support.c.

  GtkWidget *parent, *found_widget;

  for (;;)
      if (GTK_IS_MENU (widget))
        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
        parent = widget->parent;
      if (parent == NULL)
      widget = parent;

  found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
  if (!found_widget)
    g_warning ("Widget not found: %s", widget_name);
  return found_widget;