5 let xpm_label_box ~(window : #GContainer.container)
6 ~file ~text ?packing ?(show=true) () =
7 if not (Sys.file_exists file) then failwith (file ^ " does not exist");
8 let box = GPack.hbox ~border_width: 2 ?packing ~show:false () in
9 let pixmap = GDraw.pixmap_from_xpm ~file ~window () in
10 GMisc.pixmap pixmap ~packing:(box#pack ~padding:3) ();
11 GMisc.label ~text ~packing:(box#pack ~padding:3) ();
12 if show then box#misc#show ();
13 new GObj.widget_full box#as_widget
16 let window = GWindow.window ~title:"Pixmap'd Buttons!" ~border_width:10 () in
17 window#connect#destroy ~callback:Main.quit;
18 let button = GButton.button ~packing:window#add () in
19 button#connect#clicked ~callback:
20 (fun () -> prerr_endline "Hello again - cool button was pressed");
21 xpm_label_box ~window ~file:"test.xpm" ~text:"cool button"
22 ~packing:button#add ();