[Gtk-sharp-list] patch for GtkStyle

Vladimir Vukicevic vladimir@pobox.com
07 Oct 2002 22:38:02 -0700


--=-IEKZ8TUa9+YXrVicV7qM
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


patch attached; style.c needed to access the styles by index, since it's
not possible to marshal C arrays into CIL arrays.

	- Vlad

-- 
Vladimir Vukicevic <vladimir@pobox.com>

--=-IEKZ8TUa9+YXrVicV7qM
Content-Disposition: attachment; filename=style.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=style.patch; charset=ANSI_X3.4-1968

Index: gtk/ListStore.custom
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/gtk/ListStore.custom,v
retrieving revision 1.1
diff -u -r1.1 ListStore.custom
--- gtk/ListStore.custom	10 Aug 2002 23:40:20 -0000	1.1
+++ gtk/ListStore.custom	8 Oct 2002 06:18:08 -0000
@@ -29,3 +29,18 @@
 			bool ret =3D raw_ret;
 			return ret;
 		}
+
+		/// <summary>
+		///	Sets the column types.
+		/// </summary>
+		///
+		/// <remarks>
+		///	Sets the column types of this store.
+		/// </remarks>
+
+		[DllImport("gtk-x11-2.0")]
+		static extern void gtk_list_store_set_column_types (IntPtr raw, int n_co=
lumns, int[] types);
+
+		public void SetColumnTypes(int[] types) {
+			gtk_list_store_set_column_types (Handle, types.Length, types);
+		}
Index: gtk/Style.custom
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/gtk/Style.custom,v
retrieving revision 1.2
diff -u -r1.2 Style.custom
--- gtk/Style.custom	24 Sep 2002 03:21:37 -0000	1.2
+++ gtk/Style.custom	8 Oct 2002 06:18:08 -0000
@@ -32,30 +32,40 @@
 }
=20
 [DllImport("gtksharpglue")]
-static extern IntPtr[] gtksharp_gtk_style_get_fg_gc (IntPtr style);
+static extern IntPtr gtksharp_gtk_style_get_fg_gc (IntPtr style, int i);
=20
-public Gdk.GC[] ForegroundGC {
+public Gdk.GC ForegroundGC (StateType state)
+{
+	IntPtr raw =3D gtksharp_gtk_style_get_fg_gc (Handle, (int) state);
+	return EnsureGC (raw);
+}
+
+public Gdk.GC[] ForegroundGCs {
 	get {
-		IntPtr[] raws =3D gtksharp_gtk_style_get_fg_gc (Handle);
+		IntPtr[] raws =3D new IntPtr[6];
 		Gdk.GC[] ret =3D new Gdk.GC[raws.Length];
-		int i =3D 0;
-		foreach (IntPtr raw in raws) {
-			ret[i++] =3D EnsureGC (raw);
+		for (int i =3D 0; i < 6; i++) {
+			ret[i] =3D EnsureGC (gtksharp_gtk_style_get_fg_gc (Handle, i));
 		}
 		return ret;
 	}
 }
=20
 [DllImport("gtksharpglue")]
-static extern IntPtr[] gtksharp_gtk_style_get_bg_gc (IntPtr style);
+static extern IntPtr gtksharp_gtk_style_get_bg_gc (IntPtr style, int i);
+
+public Gdk.GC BackgroundGC (StateType state)
+{
+	IntPtr raw =3D gtksharp_gtk_style_get_bg_gc (Handle, (int) state);
+	return EnsureGC (raw);
+}
=20
-public Gdk.GC[] BackgroundGC {
+public Gdk.GC[] BackgroundGCs {
 	get {
-		IntPtr[] raws =3D gtksharp_gtk_style_get_bg_gc (Handle);
+		IntPtr[] raws =3D new IntPtr[6];
 		Gdk.GC[] ret =3D new Gdk.GC[raws.Length];
-		int i =3D 0;
-		foreach (IntPtr raw in raws) {
-			ret[i++] =3D EnsureGC (raw);
+		for (int i =3D 0; i < 6; i++) {
+			ret[i] =3D EnsureGC (gtksharp_gtk_style_get_bg_gc (Handle, i));
 		}
 		return ret;
 	}
@@ -76,17 +86,42 @@
 }
=20
 [DllImport("gtksharpglue")]
-static extern Gdk.Color[] gtksharp_gtk_style_get_fg (IntPtr style);
-public Gdk.Color[] Foreground {
+static extern IntPtr gtksharp_gtk_style_get_bg (IntPtr style, int i);
+
+public Gdk.Color Background (StateType state)
+{
+	IntPtr raw =3D gtksharp_gtk_style_get_bg (Handle, (int) state);
+	return Gdk.Color.New (raw);
+}
+
+public Gdk.Color[] Backgrounds {
 	get {
-		return gtksharp_gtk_style_get_fg (Handle);
+		IntPtr[] raws =3D new IntPtr[6];
+		Gdk.Color[] ret =3D new Gdk.Color[raws.Length];
+		for (int i =3D 0; i < 6; i++) {
+			ret[i] =3D Gdk.Color.New (gtksharp_gtk_style_get_bg (Handle, i));
+		}
+		return ret;
 	}
 }
=20
-static extern Gdk.Color[] gtksharp_gtk_style_get_bg (IntPtr style);
-public Gdk.Color[] Background {
+[DllImport("gtksharpglue")]
+static extern IntPtr gtksharp_gtk_style_get_fg (IntPtr style, int i);
+
+public Gdk.Color Foreground (StateType state)
+{
+	IntPtr raw =3D gtksharp_gtk_style_get_fg (Handle, (int) state);
+	return Gdk.Color.New (raw);
+}
+
+public Gdk.Color[] Foregrounds {
 	get {
-		return gtksharp_gtk_style_get_bg (Handle);
+		IntPtr[] raws =3D new IntPtr[6];
+		Gdk.Color[] ret =3D new Gdk.Color[raws.Length];
+		for (int i =3D 0; i < 6; i++) {
+			ret[i] =3D Gdk.Color.New (gtksharp_gtk_style_get_fg (Handle, i));
+		}
+		return ret;
 	}
 }
=20
Index: gtk/TreeStore.custom
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/gtk/TreeStore.custom,v
retrieving revision 1.1
diff -u -r1.1 TreeStore.custom
--- gtk/TreeStore.custom	10 Aug 2002 23:40:20 -0000	1.1
+++ gtk/TreeStore.custom	8 Oct 2002 06:18:08 -0000
@@ -109,3 +109,18 @@
 			bool ret =3D raw_ret;
 			return ret;
 		}
+
+		/// <summary>
+		///	Sets the column types.
+		/// </summary>
+		///
+		/// <remarks>
+		///	Sets the column types of this store.
+		/// </remarks>
+
+		[DllImport("gtk-x11-2.0")]
+		static extern void gtk_tree_store_set_column_types (IntPtr raw, int n_co=
lumns, int[] types);
+
+		public void SetColumnTypes(int[] types) {
+			gtk_tree_store_set_column_types (Handle, types.Length, types);
+		}





--=-IEKZ8TUa9+YXrVicV7qM--