File: Pixmap.c

package info (click to toggle)
ltt 0.9.5pre6-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,256 kB
  • ctags: 1,630
  • sloc: ansic: 17,284; sh: 8,010; makefile: 252
file content (84 lines) | stat: -rw-r--r-- 3,749 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * File: pixmaps.c
 * Auth: Jean-Hugues Deschenes, some icons by Eric Harlow
 *
 * Pixmaps used in toolbars and functions to handle them
 */

#include "Pixmap.h"

/* The pictures */
#include "Icons/New.xpm"            /* Bitmap for "new" */
#include "Icons/Open.xpm"           /* Bitmap for "open" */
#include "Icons/Close.xpm"          /* Bitmap for "close" */
#include "Icons/Dump.xpm"           /* Bitmap for "dump to file" */
#include "Icons/ZoomIn.xpm"         /* Bitmap for "zoom in" */
#include "Icons/ZoomOut.xpm"        /* Bitmap for "zoom out" */
#include "Icons/Find.xpm"           /* Bitmap for "Go To Event" */
#include "Icons/Horizon.xpm"        /* Bitmap for "Horizon" */
#include "Icons/SchedChng.xpm"      /* Bitmap for "schedule change" */
#include "Icons/KernelTimer.xpm"    /* Bitmap for "kernel timer" */
#include "Icons/SysCall.xpm"        /* Bitmap for "system call" */
#include "Icons/Trap.xpm"           /* Bitmap for "trap" */
#include "Icons/BottomHalf.xpm"     /* Bitmap for "bottom half" */
#include "Icons/IOStart.xpm"        /* Bitmap for "I/O Start" */
#include "Icons/IOEnd.xpm"          /* Bitmap for "I/O End" */
#include "Icons/IRQ.xpm"            /* Bitmap for "IRQ" */

#include "Icons/RTAIMount.xpm"      /* Bitmap for "RTAI Mount" */
#include "Icons/RTAIUmount.xpm"     /* Bitmap for "RTAI Unmount" */
#include "Icons/RTAIIrq.xpm"        /* Bitmap for "RTAI IRQ" */
#include "Icons/RTAITask.xpm"       /* Bitmap for "RTAI Task" */
#include "Icons/RTAITimer.xpm"      /* Bitmap for "RTAI Timer" */
#include "Icons/RTAISem.xpm"        /* Bitmap for "RTAI Semaphore" */
#include "Icons/RTAIMsg.xpm"        /* Bitmap for "RTAI Message" */
#include "Icons/RTAIRPC.xpm"        /* Bitmap for "RTAI RPC" */
#include "Icons/RTAIMbx.xpm"        /* Bitmap for "RTAI Mail-box" */
#include "Icons/RTAIFifo.xpm"       /* Bitmap for "RTAI FIFO" */
#include "Icons/RTAIShm.xpm"        /* Bitmap for "RTAI Shared memory" */
#include "Icons/RTAIPosix.xpm"      /* Bitmap for "RTAI Posix" */
#include "Icons/RTAILXRT.xpm"       /* Bitmap for "RTAI LXRT" */
#include "Icons/RTAILXRTI.xpm"      /* Bitmap for "RTAI LXRT-Informed" */

#include "Icons/IconTextOFF.xpm"    /* Bitmap for "icon text toggle" */
#include "Icons/SysCallsOFF.xpm"    /* Bitmap for "Syscall toggle" */
#include "Icons/IRQsOFF.xpm"        /* Bitmap for "IRQ toggle" */
#include "Icons/TrapsOFF.xpm"       /* Bitmap for "Traps toggle" */
#include "Icons/BottomHalfOFF.xpm"  /* Bitmap for "SoftIRQ toggle" */
#include "Icons/SchedChngOFF.xpm"   /* Bitmap for "Schedule change toggle" */
#include "Icons/KernelTimerOFF.xpm" /* Bitmap for "kernel timer" */

#include "Icons/SlowH.xpm"          /* Bitmap for "Slow horizontal lines draw" */
#include "Icons/SlowV.xpm"          /* Bitmap for "Slow vertical lines draw" */
#include "Icons/SlowI.xpm"          /* Bitmap for "Slow icon draw" */

#include "Icons/mini-LTT.xpm"       /* Main window icon */

/*
 * CreateWidgetFromXpm
 *
 * Using the window information and the string with the icon color/data, 
 * create a widget that represents the data.  Once done, this widget can
 * be added to buttons or other container widgets.
 *
 * This function modified from CreateWidgetFromXpm (c)Eric Harlow
 */
GtkWidget *CreateWidgetFromXpm (GtkWidget *widget, gchar **xpm_data)
{
  
  GdkBitmap *mask;
  GdkPixmap *pixmap_data;
  GtkStyle  *style;
  GtkWidget *pixmap_widget;

  /* Get the pixmap from gdk */
  style = gtk_widget_get_style( widget );
  pixmap_data = gdk_pixmap_create_from_xpm_d( widget->window,  &mask,
					      &style->bg[GTK_STATE_NORMAL],
					      (gchar **)xpm_data );

  pixmap_widget = gtk_pixmap_new (pixmap_data, mask);
  gtk_widget_show (pixmap_widget);
  
  return (pixmap_widget);
}