From b394413480b10c893060cdf3fec54f37be45b7fb Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Thu, 10 Mar 2005 16:06:59 +0000 Subject: [PATCH] 2005-03-10 Mike Kestner * gtk/Style.custom : add bg_pixmap accessors. remove IntPtr[] vars and s/6/5 for array sizes. * gtk/glue/style.c : add bg_pixmap field glue. [Fixes #73532] svn path=/trunk/gtk-sharp/; revision=41648 --- ChangeLog | 7 ++++ gtk/Style.custom | 83 +++++++++++++++++++++++++++--------------------- gtk/glue/style.c | 18 +++++++++++ 3 files changed, 72 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96b64e020..7c2bbe02f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-03-10 Mike Kestner + + * gtk/Style.custom : add bg_pixmap accessors. remove IntPtr[] vars + and s/6/5 for array sizes. + * gtk/glue/style.c : add bg_pixmap field glue. + [Fixes #73532] + 2005-03-09 Mike Kestner * */*.custom : scrub for string usage in DllImports. diff --git a/gtk/Style.custom b/gtk/Style.custom index e0b2c11df..7a539f57e 100644 --- a/gtk/Style.custom +++ b/gtk/Style.custom @@ -3,8 +3,10 @@ // // Authors: Rachel Hestilow // Radek Doulik +// Mike Kestner // // Copyright (C) 2002, 2003 Rachel Hestilow, Radek Doulik +// Copyright (C) 2005 Novell, Inc. // // This code is inserted after the automatically generated code. // @@ -66,11 +68,9 @@ public void SetForegroundGC (StateType state, Gdk.GC gc) public Gdk.GC[] ForegroundGCs { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.GC[] ret = new Gdk.GC[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.GC[] ret = new Gdk.GC[5]; + for (int i = 0; i < 5; i++) ret[i] = EnsureGC (gtksharp_gtk_style_get_fg_gc (Handle, i)); - } return ret; } } @@ -94,11 +94,9 @@ public void SetBackgroundGC (StateType state, Gdk.GC gc) public Gdk.GC[] BackgroundGCs { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.GC[] ret = new Gdk.GC[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.GC[] ret = new Gdk.GC[5]; + for (int i = 0; i < 5; i++) ret[i] = EnsureGC (gtksharp_gtk_style_get_bg_gc (Handle, i)); - } return ret; } } @@ -230,11 +228,9 @@ public Gdk.Color Background (StateType state) public Gdk.Color[] Backgrounds { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.Color[] ret = new Gdk.Color[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.Color[] ret = new Gdk.Color[5]; + for (int i = 0; i < 5; i++) ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_bg (Handle, i)); - } return ret; } } @@ -250,11 +246,9 @@ public Gdk.Color Foreground (StateType state) public Gdk.Color[] Foregrounds { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.Color[] ret = new Gdk.Color[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.Color[] ret = new Gdk.Color[5]; + for (int i = 0; i < 5; i++) ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_fg (Handle, i)); - } return ret; } } @@ -270,11 +264,9 @@ public Gdk.Color Text (StateType state) public Gdk.Color[] TextColors { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.Color[] ret = new Gdk.Color[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.Color[] ret = new Gdk.Color[5]; + for (int i = 0; i < 5; i++) ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_text (Handle, i)); - } return ret; } } @@ -290,11 +282,9 @@ public Gdk.Color Base (StateType state) public Gdk.Color[] BaseColors { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.Color[] ret = new Gdk.Color[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.Color[] ret = new Gdk.Color[5]; + for (int i = 0; i < 5; i++) ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_base (Handle, i)); - } return ret; } } @@ -310,11 +300,9 @@ public Gdk.Color Light (StateType state) public Gdk.Color[] LightColors { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.Color[] ret = new Gdk.Color[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.Color[] ret = new Gdk.Color[5]; + for (int i = 0; i < 5; i++) ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_light (Handle, i)); - } return ret; } } @@ -330,11 +318,9 @@ public Gdk.Color Mid (StateType state) public Gdk.Color[] MidColors { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.Color[] ret = new Gdk.Color[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.Color[] ret = new Gdk.Color[5]; + for (int i = 0; i < 5; i++) ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_mid (Handle, i)); - } return ret; } } @@ -350,11 +336,9 @@ public Gdk.Color Dark (StateType state) public Gdk.Color[] DarkColors { get { - IntPtr[] raws = new IntPtr[6]; - Gdk.Color[] ret = new Gdk.Color[raws.Length]; - for (int i = 0; i < 6; i++) { + Gdk.Color[] ret = new Gdk.Color[5]; + for (int i = 0; i < 5; i++) ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_dark (Handle, i)); - } return ret; } } @@ -399,3 +383,30 @@ public Pango.FontDescription FontDescription { return ret; } } + +[DllImport ("gtksharpglue-2")] +static extern IntPtr gtksharp_gtk_style_get_bg_pixmap (IntPtr style, int state); + +[DllImport ("gtksharpglue-2")] +static extern void gtksharp_gtk_style_set_bg_pixmap (IntPtr style, int state, IntPtr pixmap); + +public Gdk.Pixmap BgPixmap (StateType state) +{ + IntPtr raw = gtksharp_gtk_style_get_bg_pixmap (Handle, (int) state); + return GLib.Object.GetObject (raw) as Gdk.Pixmap; +} + +public Gdk.Pixmap[] BgPixmaps { + get { + Gdk.Pixmap[] ret = new Gdk.Pixmap [5]; + for (int i = 0; i < 5; i++) + ret [i] = GLib.Object.GetObject (gtksharp_gtk_style_get_dark (Handle, i)) as Gdk.Pixmap; + return ret; + } +} + +public void SetBgPixmap (StateType state, Gdk.Pixmap pixmap) +{ + gtksharp_gtk_style_set_bg_pixmap (Handle, (int) state, pixmap == null ? IntPtr.Zero : pixmap.Handle); +} + diff --git a/gtk/glue/style.c b/gtk/glue/style.c index 87c8ea2ff..652989802 100644 --- a/gtk/glue/style.c +++ b/gtk/glue/style.c @@ -82,6 +82,11 @@ PangoFontDescription *gtksharp_gtk_style_get_font_description (GtkStyle *style); int gtksharp_gtk_style_get_thickness (GtkStyle *style, int x); void gtksharp_gtk_style_set_thickness (GtkStyle *style, int thickness); + +GdkPixmap *gtksharp_gtk_style_get_bg_pixmap (GtkStyle *style, int i); + +void gtksharp_gtk_style_set_bg_pixmap (GtkStyle *style, int i, GdkPixmap *pixmap); + /* */ /* FIXME: include all fields */ @@ -282,3 +287,16 @@ gtksharp_gtk_style_set_thickness (GtkStyle *style, int thickness) else style->ythickness = -thickness; } + +GdkPixmap * +gtksharp_gtk_style_get_bg_pixmap (GtkStyle *style, int i) +{ + return style->bg_pixmap[i]; +} + +void gtksharp_gtk_style_set_bg_pixmap (GtkStyle *style, int i, GdkPixmap *pixmap) +{ + g_object_ref (G_OBJECT (pixmap)); + style->bg_pixmap[i] = pixmap; +} +