Add helper rouintes
svn path=/trunk/gtk-sharp/; revision=24064
This commit is contained in:
parent
51a6b95ed4
commit
2410790dbf
3 changed files with 58 additions and 0 deletions
|
@ -26,3 +26,20 @@ public void DrawLines(Gdk.GC gc, Gdk.Point[] points)
|
|||
gdk_draw_lines(Handle, gc.Handle, points, points.Length);
|
||||
}
|
||||
|
||||
[DllImport("libgdk-win32-2.0-0.dll")]
|
||||
internal static extern IntPtr gdk_x11_drawable_get_xdisplay (IntPtr raw);
|
||||
|
||||
[DllImport("libgdk-win32-2.0-0.dll")]
|
||||
internal static extern IntPtr gdk_x11_drawable_get_xid (IntPtr raw);
|
||||
|
||||
#if MANLY_ENOUGH_TO_INCLUDE
|
||||
public virtual Cairo.Graphics CairoGraphics ()
|
||||
{
|
||||
Cairo.Graphics o = new Cairo.Graphics ();
|
||||
|
||||
IntPtr display = gdk_x11_drawable_get_xdisplay (Handle);
|
||||
o.SetTargetDrawable (display, gdk_x11_drawable_get_xid (Handle));
|
||||
|
||||
return o;
|
||||
}
|
||||
#endif
|
9
gdk/Pixmap.custom
Normal file
9
gdk/Pixmap.custom
Normal file
|
@ -0,0 +1,9 @@
|
|||
//
|
||||
// Pixmap extensions
|
||||
//
|
||||
|
||||
public Pixmap (Gdk.Drawable drawable, int width, int height)
|
||||
: this (drawable, width, height, -1)
|
||||
{
|
||||
}
|
||||
|
|
@ -52,3 +52,35 @@
|
|||
}
|
||||
}
|
||||
|
||||
public void MoveResize (Gdk.Rectangle rect) {
|
||||
gdk_window_move_resize (Handle, rect.X, rect.Y, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
public void ClearArea (Gdk.Rectangle rect, bool expose) {
|
||||
if (expose)
|
||||
gdk_window_clear_area_e (Handle, rect.X, rect.Y, rect.Width, rect.Height);
|
||||
else
|
||||
gdk_window_clear_area (Handle, rect.X, rect.Y, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
#if MANLY_ENOUGH_TO_INCLUDE
|
||||
public Cairo.Graphics CairoGraphics (out int offset_x, out int offset_y)
|
||||
{
|
||||
IntPtr real_drawable;
|
||||
Cairo.Graphics o = new Cairo.Graphics ();
|
||||
|
||||
gdk_window_get_internal_paint_info (Handle, out real_drawable, out offset_x, out offset_y);
|
||||
IntPtr x11 = gdk_x11_drawable_get_xid (real_drawable);
|
||||
IntPtr display = gdk_x11_drawable_get_xdisplay (real_drawable);
|
||||
o.SetTargetDrawable (display, x11);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
public override Cairo.Graphics CairoGraphics ()
|
||||
{
|
||||
int x, y;
|
||||
return CairoGraphics (out x, out y);
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue