Project Homepage Sourceforge Page CVS Repository Freshmeat.net Page Download project Author's Homepage

support.h File Reference


Detailed Description

support functionality This file was originally created by glade

Definition in file support.h.

#include <gtk/gtk.h>

Include dependency graph for support.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define get_widget   lookup_widget

Functions

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
 

get_widget() is deprecated. Use lookup_widget instead.

Definition at line 48 of file support.h.


Function Documentation

void add_pixmap_directory const gchar *  directory  ) 
 

Use this function to set the directory containing installed pixmaps.

Definition at line 102 of file support.c.

References pixmaps_directories.

00103 {
00104   pixmaps_directories = g_list_prepend (pixmaps_directories,
00105                                         g_strdup (directory));
00106 }

GtkWidget* create_pixmap GtkWidget *  widget,
const gchar *  filename
 

This is used to create the pixmaps in the interface.

Definition at line 110 of file support.c.

References check_file_exists(), create_dummy_pixmap(), and pixmaps_directories.

00112 {
00113   gchar *found_filename = NULL;
00114   GdkColormap *colormap;
00115   GdkPixmap *gdkpixmap;
00116   GdkBitmap *mask;
00117   GtkWidget *pixmap;
00118   GList *elem;
00119 
00120   if (!filename || !filename[0])
00121       return create_dummy_pixmap (widget);
00122 
00123   /* We first try any pixmaps directories set by the application. */
00124   elem = pixmaps_directories;
00125   while (elem)
00126     {
00127       found_filename = check_file_exists ((gchar*)elem->data, filename);
00128       if (found_filename)
00129         break;
00130       elem = elem->next;
00131     }
00132 
00133   /* If we haven't found the pixmap, try the source directory. */
00134   if (!found_filename)
00135     {
00136       found_filename = check_file_exists ("../pixmaps", filename);
00137     }
00138 
00139   if (!found_filename)
00140     {
00141       g_warning ("Couldn't find pixmap file: %s", filename);
00142       return create_dummy_pixmap (widget);
00143     }
00144 
00145   colormap = gtk_widget_get_colormap (widget);
00146   gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
00147                                                    NULL, found_filename);
00148   if (gdkpixmap == NULL)
00149     {
00150       g_warning ("Error loading pixmap file: %s", found_filename);
00151       g_free (found_filename);
00152       return create_dummy_pixmap (widget);
00153     }
00154   g_free (found_filename);
00155   pixmap = gtk_pixmap_new (gdkpixmap, mask);
00156   gdk_pixmap_unref (gdkpixmap);
00157   gdk_bitmap_unref (mask);
00158   return pixmap;
00159 }

Here is the call graph for this function:

GtkWidget* lookup_widget GtkWidget *  widget,
const gchar *  widget_name
 

This function returns a widget in a component created by Glade. Call it with the toplevel widget in the component (i.e. a window/dialog), or alternatively any widget in the component, and the name of the widget you want returned.

Definition at line 46 of file support.c.

00048 {
00049   GtkWidget *parent, *found_widget;
00050 
00051   for (;;)
00052     {
00053       if (GTK_IS_MENU (widget))
00054         parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
00055       else
00056         parent = widget->parent;
00057       if (parent == NULL)
00058         break;
00059       widget = parent;
00060     }
00061 
00062   found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
00063                                                    widget_name);
00064   if (!found_widget)
00065     g_warning ("Widget not found: %s", widget_name);
00066   return found_widget;
00067 }


Generated on Thu Mar 18 07:26:19 2004 for run-free by doxygen 1.3.5