mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-27 07:35:37 +00:00
de7e997c13
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
152 lines
3.6 KiB
Plaintext
152 lines
3.6 KiB
Plaintext
//
|
|
// Gtk.Style.custom - Gtk Style class customizations
|
|
//
|
|
// Author: Rachel Hestilow <hestilow@ximian.com>
|
|
//
|
|
// Copyright (C) 2002 Rachel Hestilow
|
|
//
|
|
// This code is inserted after the automatically generated code.
|
|
//
|
|
|
|
static Gdk.GC EnsureGC (IntPtr raw) {
|
|
if (raw == IntPtr.Zero)
|
|
return null;
|
|
Gdk.GC ret = (Gdk.GC) GLib.Object.GetObject (raw);
|
|
if (ret == null)
|
|
ret = new Gdk.GC (raw);
|
|
return ret;
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern IntPtr gtksharp_gtk_style_get_white_gc (IntPtr style);
|
|
|
|
public Gdk.GC WhiteGC {
|
|
get { return EnsureGC (gtksharp_gtk_style_get_white_gc (Handle)); }
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern IntPtr gtksharp_gtk_style_get_black_gc (IntPtr style);
|
|
|
|
public Gdk.GC BlackGC {
|
|
get { return EnsureGC (gtksharp_gtk_style_get_black_gc (Handle)); }
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern IntPtr gtksharp_gtk_style_get_fg_gc (IntPtr style, int i);
|
|
|
|
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 = new IntPtr[6];
|
|
Gdk.GC[] ret = new Gdk.GC[raws.Length];
|
|
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, int i);
|
|
|
|
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 = new IntPtr[6];
|
|
Gdk.GC[] ret = new Gdk.GC[raws.Length];
|
|
for (int i = 0; i < 6; i++) {
|
|
ret[i] = EnsureGC (gtksharp_gtk_style_get_bg_gc (Handle, i));
|
|
}
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern IntPtr gtksharp_gtk_style_get_white (IntPtr style);
|
|
|
|
public Gdk.Color White {
|
|
get { return Gdk.Color.New (gtksharp_gtk_style_get_white (Handle)); }
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern IntPtr gtksharp_gtk_style_get_black (IntPtr style);
|
|
|
|
public Gdk.Color Black {
|
|
get { return Gdk.Color.New (gtksharp_gtk_style_get_black (Handle)); }
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
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 {
|
|
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;
|
|
}
|
|
}
|
|
|
|
[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 {
|
|
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;
|
|
}
|
|
}
|
|
|
|
[DllImport ("gtksharpglue")]
|
|
static extern int gtksharp_gtk_style_get_thickness (IntPtr style, int x_axis);
|
|
[DllImport ("gtksharpglue")]
|
|
static extern void gtksharp_gtk_style_set_thickness (IntPtr style, int value);
|
|
|
|
public int XThickness {
|
|
get {
|
|
return gtksharp_gtk_style_get_thickness (Handle, 0);
|
|
}
|
|
|
|
set {
|
|
gtksharp_gtk_style_set_thickness (Handle, value);
|
|
}
|
|
}
|
|
|
|
public int YThickness {
|
|
get {
|
|
return gtksharp_gtk_style_get_thickness (Handle, 1);
|
|
}
|
|
|
|
set {
|
|
gtksharp_gtk_style_set_thickness (Handle, -value);
|
|
}
|
|
}
|