* 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>
|
2002-10-08 Duncan Mak <duncan@ximian.com>
|
||||||
|
|
||||||
* gdk/Color.custom:
|
* 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;
|
return style->black_gc;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkGC**
|
GdkGC*
|
||||||
gtksharp_gtk_style_get_fg_gc (GtkStyle *style)
|
gtksharp_gtk_style_get_fg_gc (GtkStyle *style, int i)
|
||||||
{
|
{
|
||||||
g_object_ref (G_OBJECT (style->fg_gc));
|
g_object_ref (G_OBJECT (style->fg_gc[i]));
|
||||||
return style->fg_gc;
|
return style->fg_gc[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkGC**
|
GdkGC*
|
||||||
gtksharp_gtk_style_get_bg_gc (GtkStyle *style)
|
gtksharp_gtk_style_get_bg_gc (GtkStyle *style, int i)
|
||||||
{
|
{
|
||||||
g_object_ref (G_OBJECT (style->bg_gc));
|
g_object_ref (G_OBJECT (style->bg_gc[i]));
|
||||||
return style->bg_gc;
|
return style->bg_gc[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkColor*
|
GdkColor*
|
||||||
|
@ -50,15 +50,15 @@ gtksharp_gtk_style_get_black (GtkStyle *style)
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkColor*
|
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**
|
GdkColor*
|
||||||
gtksharp_gtk_style_get_bg (GtkStyle *style)
|
gtksharp_gtk_style_get_bg (GtkStyle *style, int i)
|
||||||
{
|
{
|
||||||
return style->bg;
|
return &style->bg[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -32,30 +32,40 @@ public Gdk.GC BlackGC {
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("gtksharpglue")]
|
[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 {
|
get {
|
||||||
IntPtr[] raws = gtksharp_gtk_style_get_fg_gc (Handle);
|
IntPtr[] raws = new IntPtr[6];
|
||||||
Gdk.GC[] ret = new Gdk.GC[raws.Length];
|
Gdk.GC[] ret = new Gdk.GC[raws.Length];
|
||||||
int i = 0;
|
for (int i = 0; i < 6; i++) {
|
||||||
foreach (IntPtr raw in raws) {
|
ret[i] = EnsureGC (gtksharp_gtk_style_get_fg_gc (Handle, i));
|
||||||
ret[i++] = EnsureGC (raw);
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("gtksharpglue")]
|
[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 {
|
get {
|
||||||
IntPtr[] raws = gtksharp_gtk_style_get_bg_gc (Handle);
|
IntPtr[] raws = new IntPtr[6];
|
||||||
Gdk.GC[] ret = new Gdk.GC[raws.Length];
|
Gdk.GC[] ret = new Gdk.GC[raws.Length];
|
||||||
int i = 0;
|
for (int i = 0; i < 6; i++) {
|
||||||
foreach (IntPtr raw in raws) {
|
ret[i] = EnsureGC (gtksharp_gtk_style_get_bg_gc (Handle, i));
|
||||||
ret[i++] = EnsureGC (raw);
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -76,17 +86,42 @@ public Gdk.Color Black {
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("gtksharpglue")]
|
[DllImport("gtksharpglue")]
|
||||||
static extern Gdk.Color[] gtksharp_gtk_style_get_fg (IntPtr style);
|
static extern IntPtr gtksharp_gtk_style_get_bg (IntPtr style, int i);
|
||||||
public Gdk.Color[] Foreground {
|
|
||||||
|
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 {
|
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);
|
[DllImport("gtksharpglue")]
|
||||||
public Gdk.Color[] Background {
|
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 {
|
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