// IconList.custom - customizations to Gnome.IconList
//
// Authors: Mike Kestner  <mkestner@ximian.com>
//
// Copyright (c) 2004 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General 
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.


		[DllImport("gnomeui-2")]
		static extern IntPtr gnome_icon_list_get_selection (IntPtr raw);

		public int[] Selection {
			get {
				IntPtr list_ptr = gnome_icon_list_get_selection (Handle);
				if (list_ptr == IntPtr.Zero)
					return new int [0];

				GLib.List list = new GLib.List (list_ptr, typeof (int));
				int[] result = new int [list.Count];
				int i = 0;
				foreach (int val in list)
					result [i++] = val;
				return result;
			}
		}

		[DllImport("gnomeui-2")]
		static extern IntPtr gnome_icon_list_new(uint icon_width, IntPtr adj, int flags);

		public IconList (uint icon_width, Gtk.Adjustment adj, int flags) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (IconList)) {
				CreateNativeObject (new string[0], new GLib.Value[0]);
				Construct (icon_width, adj, flags);
				return;
			}
			Raw = gnome_icon_list_new(icon_width, (adj != null) ? adj.Handle : IntPtr.Zero, flags);
		}
