~ubuntu-branches/ubuntu/intrepid/libgtkada2/intrepid

« back to all changes in this revision

Viewing changes to testgtk/create_combo_box.adb

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-08-11 09:46:51 UTC
  • mfrom: (6.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20080811094651-9mjd6acwa98ffw5c
Tags: 2.12.0-2ubuntu1
Add lpia to supported architectures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
19
19
-- Boston, MA 02111-1307, USA.                                       --
20
20
--                                                                   --
21
21
-----------------------------------------------------------------------
22
22
 
23
23
with Gdk.Color;              use Gdk.Color;
32
26
with Glib;                   use Glib;
33
27
with Gtk.Box;                use Gtk.Box;
34
28
with Gtk.Frame;              use Gtk.Frame;
35
 
with Gtk.Cell_Renderer;      use Gtk.Cell_Renderer;
36
29
with Gtk.Cell_Renderer_Pixbuf; use Gtk.Cell_Renderer_Pixbuf;
37
30
with Gtk.Cell_Renderer_Text;   use Gtk.Cell_Renderer_Text;
38
31
with Gtk.Combo_Box;          use Gtk.Combo_Box;
39
32
with Gtk.Cell_Layout;        use Gtk.Cell_Layout;
40
33
with Gtk.List_Store;         use Gtk.List_Store;
41
34
with Gtk.Tree_Model;         use Gtk.Tree_Model;
42
 
with Gtk.Widget;             use Gtk.Widget;
43
35
 
44
36
package body Create_Combo_Box is
45
37
 
77
69
   procedure Fill_Pixbuf (Pix : Gdk_Pixbuf; Color : String) is
78
70
      GColor : Gdk_Color;
79
71
      Stride  : Gint;
80
 
      Num     : Gint;
 
72
      Num     : Guint;
81
73
      Pixels  : Gdk.Rgb.Rgb_Buffer_Access;
82
74
   begin
83
75
      GColor := Parse (Color);
86
78
      --  has no binding for it at the time of this writing. You could also
87
79
      --  load the images from XPM data instead.
88
80
      Stride := Get_Rowstride (Pix);
89
 
      Num    := Get_Width (Pix) * Get_Height (Pix);
 
81
      Num    := Guint (Get_Width (Pix) * Get_Height (Pix));
90
82
      Pixels := Get_Pixels (Pix);
91
83
 
92
84
      for N in 0 .. Num - 1 loop
93
85
         --  By default, each color occupies 8bits, thus is it easier to
94
86
         --  manipulate colors
95
 
         Pixels (Integer (N * 3 + 0)) := Guchar (Red   (Gcolor) / 65535 * 255);
96
 
         Pixels (Integer (N * 3 + 1)) := Guchar (Green (Gcolor) / 65535 * 255);
97
 
         Pixels (Integer (N * 3 + 2)) := Guchar (Blue  (Gcolor) / 65535 * 255);
 
87
         Pixels (N).Red   := Guchar (Red   (GColor) / 65535 * 255);
 
88
         Pixels (N).Green := Guchar (Green (GColor) / 65535 * 255);
 
89
         Pixels (N).Blue  := Guchar (Blue  (GColor) / 65535 * 255);
98
90
      end loop;
99
91
   end Fill_Pixbuf;
100
92