* glue/style.c, gtk/Style.custom: handle
getting GC's and colors correctly -- it's not possible to marshal arrays from C-land to mono correctly, so indexed accessors have to be used. svn path=/trunk/gtk-sharp/; revision=8058
This commit is contained in:
parent
854511bd98
commit
de7e997c13
3 changed files with 73 additions and 31 deletions
|
@ -1,3 +1,10 @@
|
|||
2002-10-07 Vladimir Vukicevic <vladimir@pobox.com>
|
||||
|
||||
* glue/style.c, gtk/Style.custom: handle
|
||||
getting GC's and colors correctly -- it's not possible
|
||||
to marshal arrays from C-land to mono correctly,
|
||||
so indexed accessors have to be used.
|
||||
|
||||
2002-10-08 Duncan Mak <duncan@ximian.com>
|
||||
|
||||
* gdk/Color.custom:
|
||||
|
|
26
glue/style.c
26
glue/style.c
|
@ -23,18 +23,18 @@ gtksharp_gtk_style_get_black_gc (GtkStyle *style)
|
|||
return style->black_gc;
|
||||
}
|
||||
|
||||
GdkGC**
|
||||
gtksharp_gtk_style_get_fg_gc (GtkStyle *style)
|
||||
GdkGC*
|
||||
gtksharp_gtk_style_get_fg_gc (GtkStyle *style, int i)
|
||||
{
|
||||
g_object_ref (G_OBJECT (style->fg_gc));
|
||||
return style->fg_gc;
|
||||
g_object_ref (G_OBJECT (style->fg_gc[i]));
|
||||
return style->fg_gc[i];
|
||||
}
|
||||
|
||||
GdkGC**
|
||||
gtksharp_gtk_style_get_bg_gc (GtkStyle *style)
|
||||
GdkGC*
|
||||
gtksharp_gtk_style_get_bg_gc (GtkStyle *style, int i)
|
||||
{
|
||||
g_object_ref (G_OBJECT (style->bg_gc));
|
||||
return style->bg_gc;
|
||||
g_object_ref (G_OBJECT (style->bg_gc[i]));
|
||||
return style->bg_gc[i];
|
||||
}
|
||||
|
||||
GdkColor*
|
||||
|
@ -50,15 +50,15 @@ gtksharp_gtk_style_get_black (GtkStyle *style)
|
|||
}
|
||||
|
||||
GdkColor*
|
||||
gtksharp_gtk_style_get_fg (GtkStyle *style)
|
||||
gtksharp_gtk_style_get_fg (GtkStyle *style, int i)
|
||||
{
|
||||
return style->fg;
|
||||
return &style->fg[i];
|
||||
}
|
||||
|
||||
GdkColor**
|
||||
gtksharp_gtk_style_get_bg (GtkStyle *style)
|
||||
GdkColor*
|
||||
gtksharp_gtk_style_get_bg (GtkStyle *style, int i)
|
||||
{
|
||||
return style->bg;
|
||||
return &style->bg[i];
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -32,30 +32,40 @@ public Gdk.GC BlackGC {
|
|||
}
|
||||
|
||||
[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);
|
||||
|
||||
public Gdk.GC[] ForegroundGC {
|
||||
public Gdk.GC ForegroundGC (StateType state)
|
||||
{
|
||||
IntPtr raw = gtksharp_gtk_style_get_fg_gc (Handle, (int) state);
|
||||
return EnsureGC (raw);
|
||||
}
|
||||
|
||||
public Gdk.GC[] ForegroundGCs {
|
||||
get {
|
||||
IntPtr[] raws = gtksharp_gtk_style_get_fg_gc (Handle);
|
||||
IntPtr[] raws = new IntPtr[6];
|
||||
Gdk.GC[] ret = new Gdk.GC[raws.Length];
|
||||
int i = 0;
|
||||
foreach (IntPtr raw in raws) {
|
||||
ret[i++] = EnsureGC (raw);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
ret[i] = EnsureGC (gtksharp_gtk_style_get_fg_gc (Handle, i));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
[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 {
|
||||
public Gdk.GC BackgroundGC (StateType state)
|
||||
{
|
||||
IntPtr raw = gtksharp_gtk_style_get_bg_gc (Handle, (int) state);
|
||||
return EnsureGC (raw);
|
||||
}
|
||||
|
||||
public Gdk.GC[] BackgroundGCs {
|
||||
get {
|
||||
IntPtr[] raws = gtksharp_gtk_style_get_bg_gc (Handle);
|
||||
IntPtr[] raws = new IntPtr[6];
|
||||
Gdk.GC[] ret = new Gdk.GC[raws.Length];
|
||||
int i = 0;
|
||||
foreach (IntPtr raw in raws) {
|
||||
ret[i++] = EnsureGC (raw);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
ret[i] = EnsureGC (gtksharp_gtk_style_get_bg_gc (Handle, i));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -76,17 +86,42 @@ public Gdk.Color Black {
|
|||
}
|
||||
|
||||
[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 = 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 = new IntPtr[6];
|
||||
Gdk.Color[] ret = new Gdk.Color[raws.Length];
|
||||
for (int i = 0; i < 6; i++) {
|
||||
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_bg (Handle, i));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
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 = 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 = new IntPtr[6];
|
||||
Gdk.Color[] ret = new Gdk.Color[raws.Length];
|
||||
for (int i = 0; i < 6; i++) {
|
||||
ret[i] = Gdk.Color.New (gtksharp_gtk_style_get_fg (Handle, i));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue