]> Pileus Git - ~andy/gtk/blob - examples/wheelbarrow/wheelbarrow.c
More work on #71430.
[~andy/gtk] / examples / wheelbarrow / wheelbarrow.c
1
2 #include <gtk/gtk.h>
3
4 /* XPM */
5 static char * WheelbarrowFull_xpm[] = {
6 "48 48 64 1",
7 "       c None",
8 ".      c #DF7DCF3CC71B",
9 "X      c #965875D669A6",
10 "o      c #71C671C671C6",
11 "O      c #A699A289A699",
12 "+      c #965892489658",
13 "@      c #8E38410330C2",
14 "#      c #D75C7DF769A6",
15 "$      c #F7DECF3CC71B",
16 "%      c #96588A288E38",
17 "&      c #A69992489E79",
18 "*      c #8E3886178E38",
19 "=      c #104008200820",
20 "-      c #596510401040",
21 ";      c #C71B30C230C2",
22 ":      c #C71B9A699658",
23 ">      c #618561856185",
24 ",      c #20811C712081",
25 "<      c #104000000000",
26 "1      c #861720812081",
27 "2      c #DF7D4D344103",
28 "3      c #79E769A671C6",
29 "4      c #861782078617",
30 "5      c #41033CF34103",
31 "6      c #000000000000",
32 "7      c #49241C711040",
33 "8      c #492445144924",
34 "9      c #082008200820",
35 "0      c #69A618611861",
36 "q      c #B6DA71C65144",
37 "w      c #410330C238E3",
38 "e      c #CF3CBAEAB6DA",
39 "r      c #71C6451430C2",
40 "t      c #EFBEDB6CD75C",
41 "y      c #28A208200820",
42 "u      c #186110401040",
43 "i      c #596528A21861",
44 "p      c #71C661855965",
45 "a      c #A69996589658",
46 "s      c #30C228A230C2",
47 "d      c #BEFBA289AEBA",
48 "f      c #596545145144",
49 "g      c #30C230C230C2",
50 "h      c #8E3882078617",
51 "j      c #208118612081",
52 "k      c #38E30C300820",
53 "l      c #30C2208128A2",
54 "z      c #38E328A238E3",
55 "x      c #514438E34924",
56 "c      c #618555555965",
57 "v      c #30C2208130C2",
58 "b      c #38E328A230C2",
59 "n      c #28A228A228A2",
60 "m      c #41032CB228A2",
61 "M      c #104010401040",
62 "N      c #492438E34103",
63 "B      c #28A2208128A2",
64 "V      c #A699596538E3",
65 "C      c #30C21C711040",
66 "Z      c #30C218611040",
67 "A      c #965865955965",
68 "S      c #618534D32081",
69 "D      c #38E31C711040",
70 "F      c #082000000820",
71 "                                                ",
72 "          .XoO                                  ",
73 "         +@#$%o&                                ",
74 "         *=-;#::o+                              ",
75 "           >,<12#:34                            ",
76 "             45671#:X3                          ",
77 "               +89<02qwo                        ",
78 "e*                >,67;ro                       ",
79 "ty>                 459@>+&&                    ",
80 "$2u+                  ><ipas8*                  ",
81 "%$;=*                *3:.Xa.dfg>                ",
82 "Oh$;ya             *3d.a8j,Xe.d3g8+             ",
83 " Oh$;ka          *3d$a8lz,,xxc:.e3g54           ",
84 "  Oh$;kO       *pd$%svbzz,sxxxxfX..&wn>         ",
85 "   Oh$@mO    *3dthwlsslszjzxxxxxxx3:td8M4       ",
86 "    Oh$@g& *3d$XNlvvvlllm,mNwxxxxxxxfa.:,B*     ",
87 "     Oh$@,Od.czlllllzlmmqV@V#V@fxxxxxxxf:%j5&   ",
88 "      Oh$1hd5lllslllCCZrV#r#:#2AxxxxxxxxxcdwM*  ",
89 "       OXq6c.%8vvvllZZiqqApA:mq:Xxcpcxxxxxfdc9* ",
90 "        2r<6gde3bllZZrVi7S@SV77A::qApxxxxxxfdcM ",
91 "        :,q-6MN.dfmZZrrSS:#riirDSAX@Af5xxxxxfevo",
92 "         +A26jguXtAZZZC7iDiCCrVVii7Cmmmxxxxxx%3g",
93 "          *#16jszN..3DZZZZrCVSA2rZrV7Dmmwxxxx&en",
94 "           p2yFvzssXe:fCZZCiiD7iiZDiDSSZwwxx8e*>",
95 "           OA1<jzxwwc:$d%NDZZZZCCCZCCZZCmxxfd.B ",
96 "            3206Bwxxszx%et.eaAp77m77mmmf3&eeeg* ",
97 "             @26MvzxNzvlbwfpdettttttttttt.c,n&  ",
98 "             *;16=lsNwwNwgsvslbwwvccc3pcfu<o    ",
99 "              p;<69BvwwsszslllbBlllllllu<5+     ",
100 "              OS0y6FBlvvvzvzss,u=Blllj=54       ",
101 "               c1-699Blvlllllu7k96MMMg4         ",
102 "               *10y8n6FjvllllB<166668           ",
103 "                S-kg+>666<M<996-y6n<8*          ",
104 "                p71=4 m69996kD8Z-66698&&        ",
105 "                &i0ycm6n4 ogk17,0<6666g         ",
106 "                 N-k-<>     >=01-kuu666>        ",
107 "                 ,6ky&      &46-10ul,66,        ",
108 "                 Ou0<>       o66y<ulw<66&       ",
109 "                  *kk5       >66By7=xu664       ",
110 "                   <<M4      466lj<Mxu66o       ",
111 "                   *>>       +66uv,zN666*       ",
112 "                              566,xxj669        ",
113 "                              4666FF666>        ",
114 "                               >966666M         ",
115 "                                oM6668+         ",
116 "                                  *4            ",
117 "                                                ",
118 "                                                "};
119
120
121 /* When invoked (via signal delete_event), terminates the application */
122 gint close_application( GtkWidget *widget,
123                         GdkEvent  *event,
124                         gpointer   data )
125 {
126     gtk_main_quit();
127     return(FALSE);
128 }
129
130 int main (int argc,
131           char *argv[] )
132 {
133     /* GtkWidget is the storage type for widgets */
134     GtkWidget *window, *pixmap, *fixed;
135     GdkPixmap *gdk_pixmap;
136     GdkBitmap *mask;
137     GtkStyle *style;
138     GdkGC *gc;
139     
140     /* Create the main window, and attach delete_event signal to terminate
141      * the application.  Note that the main window will not have a titlebar
142      * since we're making it a popup. */
143     gtk_init (&argc, &argv);
144     window = gtk_window_new( GTK_WINDOW_POPUP );
145     g_signal_connect (GTK_OBJECT (window), "delete_event",
146                         GTK_SIGNAL_FUNC (close_application), NULL);
147     gtk_widget_show (window);
148
149     /* Now for the pixmap and the pixmap widget */
150     style = gtk_widget_get_default_style();
151     gc = style->black_gc;
152     gdk_pixmap = gdk_pixmap_create_from_xpm_d( window->window, &mask,
153                                              &style->bg[GTK_STATE_NORMAL],
154                                              WheelbarrowFull_xpm );
155     pixmap = gtk_image_new_from_pixmap (gdk_pixmap, mask);
156     gtk_widget_show( pixmap );
157
158     /* To display the pixmap, we use a fixed widget to place the pixmap */
159     fixed = gtk_fixed_new();
160     gtk_widget_set_size_request (fixed, 200, 200);
161     gtk_fixed_put( GTK_FIXED(fixed), pixmap, 0, 0 );
162     gtk_container_add( GTK_CONTAINER(window), fixed );
163     gtk_widget_show( fixed );
164
165     /* This masks out everything except for the image itself */
166     gtk_widget_shape_combine_mask( window, mask, 0, 0 );
167     
168     /* show the window */
169     /*gtk_widget_set_uposition( window, 20, 400 );*/
170     gtk_widget_show( window );
171     gtk_main ();
172           
173     return 0;
174 }