3eb398a12f
* gtk/Widget.custom : new OnSetScrollAdjustments VM. * gtk/glue/widget.c : glue for new VM. svn path=/trunk/gtk-sharp/; revision=34293
194 lines
5 KiB
Text
194 lines
5 KiB
Text
//
|
|
// Gtk.Widget.custom - Gtk Widget class customizations
|
|
//
|
|
// Author: Rachel Hestilow <hestilow@ximian.com>
|
|
//
|
|
// Copyright (C) 2002 Rachel Hestilow
|
|
//
|
|
// This code is inserted after the automatically generated code.
|
|
//
|
|
//
|
|
// This program is free software; you can redistribute it and/or
|
|
// modify it under the terms of version 2 of the Lesser GNU General
|
|
// Public License as published by the Free Software Foundation.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this program; if not, write to the
|
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern IntPtr gtksharp_gtk_widget_get_allocation (IntPtr style);
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern void gtksharp_gtk_widget_set_allocation (IntPtr raw, Gdk.Rectangle rect);
|
|
|
|
public Gdk.Rectangle Allocation {
|
|
get { return Gdk.Rectangle.New (gtksharp_gtk_widget_get_allocation (Handle)); }
|
|
set { gtksharp_gtk_widget_set_allocation (Handle, value); }
|
|
}
|
|
|
|
|
|
[DllImport ("gtksharpglue")]
|
|
static extern IntPtr gtksharp_gtk_widget_get_window (IntPtr widget);
|
|
[DllImport ("gtksharpglue")]
|
|
static extern void gtksharp_gtk_widget_set_window (IntPtr widget, IntPtr window);
|
|
public Gdk.Window GdkWindow {
|
|
get {
|
|
IntPtr raw_ret = gtksharp_gtk_widget_get_window (Handle);
|
|
|
|
if (raw_ret != (IntPtr) 0){
|
|
Gdk.Window ret = (Gdk.Window) GLib.Object.GetObject(raw_ret, false);
|
|
return ret;
|
|
}
|
|
return null;
|
|
}
|
|
set {
|
|
Gdk.Window window = value as Gdk.Window;
|
|
gtksharp_gtk_widget_set_window (Handle, window.Handle);
|
|
}
|
|
}
|
|
|
|
public void AddAccelerator (string accel_signal, AccelGroup accel_group, AccelKey accel_key)
|
|
{
|
|
this.AddAccelerator (accel_signal, accel_group, (uint) accel_key.Key, accel_key.AccelMods, accel_key.AccelFlags);
|
|
|
|
}
|
|
|
|
[DllImport("libgtk-win32-2.0-0.dll")]
|
|
static extern void gtk_widget_set_state (IntPtr raw, int state);
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern int gtksharp_gtk_widget_get_state (IntPtr raw);
|
|
|
|
public Gtk.StateType State {
|
|
set {
|
|
gtk_widget_set_state (Handle, (int) value);
|
|
}
|
|
get {
|
|
return (Gtk.StateType) gtksharp_gtk_widget_get_state (Handle);
|
|
}
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern int gtksharp_gtk_widget_get_flags (IntPtr raw);
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern void gtksharp_gtk_widget_set_flags (IntPtr raw, int flags);
|
|
|
|
public int Flags {
|
|
get {
|
|
return gtksharp_gtk_widget_get_flags (Handle);
|
|
}
|
|
set {
|
|
gtksharp_gtk_widget_set_flags (Handle, (int) value);
|
|
}
|
|
}
|
|
|
|
public void SetFlag (WidgetFlags flag)
|
|
{
|
|
Flags |= (int)flag;
|
|
}
|
|
|
|
public void ClearFlag (WidgetFlags flag)
|
|
{
|
|
Flags &= ~((int)flag);
|
|
}
|
|
|
|
public bool IsMapped {
|
|
get {
|
|
return ((Flags & (int)Gtk.WidgetFlags.Mapped) != 0);
|
|
}
|
|
}
|
|
|
|
public bool IsRealized {
|
|
get {
|
|
return ((Flags & (int)Gtk.WidgetFlags.Realized) != 0);
|
|
}
|
|
}
|
|
|
|
public bool IsNoWindow {
|
|
get {
|
|
return ((Flags & (int)Gtk.WidgetFlags.NoWindow) != 0);
|
|
}
|
|
}
|
|
|
|
public bool IsTopLevel {
|
|
get {
|
|
return ((Flags & (int)Gtk.WidgetFlags.Toplevel) != 0);
|
|
}
|
|
}
|
|
|
|
public bool HasGrab {
|
|
get {
|
|
return ((Flags & (int)Gtk.WidgetFlags.HasGrab) != 0);
|
|
}
|
|
}
|
|
|
|
public bool IsCompositeChild {
|
|
get {
|
|
return ((Flags & (int)Gtk.WidgetFlags.CompositeChild) != 0);
|
|
}
|
|
}
|
|
|
|
public bool IsAppPaintable {
|
|
get {
|
|
return ((Flags & (int)Gtk.WidgetFlags.AppPaintable) != 0);
|
|
}
|
|
}
|
|
|
|
public bool IsDoubleBuffered {
|
|
get {
|
|
return ((Flags & (int)Gtk.WidgetFlags.DoubleBuffered) != 0);
|
|
}
|
|
}
|
|
|
|
|
|
public bool IsDrawable {
|
|
get {
|
|
return (Visible && IsMapped);
|
|
}
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern int gtksharp_gtk_widget_style_get_int (IntPtr raw, string name);
|
|
|
|
public int FocusLineWidth {
|
|
get {
|
|
return gtksharp_gtk_widget_style_get_int (Handle, "focus-line-width");
|
|
}
|
|
}
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern int gtksharp_widget_connect_set_scroll_adjustments_signal (IntPtr gtype, SetScrollAdjustmentsDelegate cb);
|
|
|
|
delegate void SetScrollAdjustmentsDelegate (IntPtr widget, IntPtr hadj, IntPtr vadj);
|
|
|
|
static SetScrollAdjustmentsDelegate SetScrollAdjustmentsCallback;
|
|
|
|
static void SetScrollAdjustments_cb (IntPtr widget, IntPtr hadj, IntPtr vadj)
|
|
{
|
|
Widget obj = GLib.Object.GetObject (widget, false) as Widget;
|
|
Gtk.Adjustment h = GLib.Object.GetObject (hadj, false) as Gtk.Adjustment;
|
|
Gtk.Adjustment v = GLib.Object.GetObject (vadj, false) as Gtk.Adjustment;
|
|
obj.OnSetScrollAdjustments (h, v);
|
|
}
|
|
|
|
static void ConnectSetScrollAdjustments (GLib.GType gtype)
|
|
{
|
|
if (SetScrollAdjustmentsCallback == null)
|
|
SetScrollAdjustmentsCallback = new SetScrollAdjustmentsDelegate (SetScrollAdjustments_cb);
|
|
gtksharp_widget_connect_set_scroll_adjustments_signal (gtype.Val, SetScrollAdjustmentsCallback);
|
|
}
|
|
|
|
[GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectSetScrollAdjustments")]
|
|
protected virtual void OnSetScrollAdjustments (Gtk.Adjustment hadj, Gtk.Adjustment vadj)
|
|
{
|
|
}
|
|
|