From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ce7480df3c595843 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed2.ip.tiscali.net!tiscali!newsfeed1.ip.tiscali.net!news.addix.net!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: Michael Bode Newsgroups: comp.lang.ada Subject: Re: [newbie] Load a image file into a GTKimage Date: Thu, 11 Jan 2007 19:40:45 +0100 Organization: 1&1 Internet AG Message-ID: References: <45a63894$0$291$426a74cc@news.free.fr> NNTP-Posting-Host: p54af0aac.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: online.de 1168540853 29972 84.175.10.172 (11 Jan 2007 18:40:53 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Thu, 11 Jan 2007 18:40:53 +0000 (UTC) X-message-flag: IMPORTANT MESSAGE -- PLEASE READ IMMEDIATELY!!! X-Accepted-File-Formats: ASCII, .rtf, .ps, .pdf - *NO* MS Office files User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Xref: g2news2.google.com comp.lang.ada:8111 Date: 2007-01-11T19:40:45+01:00 List-Id: Rangdalf writes: > I have to display an image in my gtk form. So I have added an gtkimage > but I want to know of to display a file in it. The simplest thing, if this is a static image (e.g. company logo or something) and you use glade, would be to set the image file name in glade. Otherwise you can use Gtk.Image.Set: procedure Set (Image : access Gtk_Image_Record; File : String); procedure Set (Image : access Gtk_Image_Record; Pixbuf : Gdk.Pixbuf.Gdk_Pixbuf); procedure Set (Image : access Gtk_Image_Record; Stock_Id : String; Size : Gtk.Enums.Gtk_Icon_Size); If you have some small icons that you want to directly include in your code so you don't have to keep track of icon files you could use the Ada version of .xpm images. Use the 2nd form of Set above to display the icon: with Gdk.Pixbuf; package Icons is procedure Init; LED_Green : Gdk.Pixbuf.Gdk_Pixbuf; end Icons; with Gtkada.Types; use Gtkada.Types; package body Icons is LED_Green_XPM : Chars_Ptr_Array := "31 12 9 1" + " c #286028" + ". c #227722" + "+ c #1D8D1D" + "@ c #17A417" + "# c #11BB11" + "$ c #0CD10C" + "% c #00FF00" + "& c #2E492E" + "* c #333333" + " .++@@@@@###############@@@@@+" + " .+@@###$$$$$$$$$$$$$$$$$$$###@" + ".+@#$$%%%%%%%%%%%%%%%%%%%%%%%$$" + ".+@#$$%%%%%%%%%%%%%%%%%%%%%%%$$" + " .+@@###$$$$$$$$$$$$$$$$$$$###@" + " .++@@@@#################@@@@+" + "& ..+++++@@@@@@@@@@@@@@@+++++." + "*&& ...+++++++++++++++++... " + "***&&& ............. &&" + "******&&&& &&&&**" + "***********&&&&&&&&&&&&&*******" + "*******************************"; procedure Init is begin LED_Green := Gdk.Pixbuf.Gdk_New_From_Xpm_Data (LED_Green_XPM); end Init; end Icons; -- Michael Bode