// Gtk.Window.cs - GTK Window class implementation // // Author: Mike Kestner // // (c) 2001 Mike Kestner namespace Gtk { using GLib; using System; using System.Drawing; using System.Runtime.InteropServices; public enum WindowType { TopLevel, Popup, } public class Window : Widget { /// /// Window Object Constructor /// /// /// /// Constructs a Window Wrapper. /// public Window (IntPtr o) { RawObject = o; } /// /// Window Constructor /// /// /// /// Constructs a new Window of type TopLevel. /// [DllImport("gtk-1.3.dll")] static extern IntPtr gtk_window_new (WindowType type); public Window () { RawObject = gtk_window_new (WindowType.TopLevel); } /// /// Window Constructor /// /// /// /// Constructs a new Window of type TopLevel with the /// specified Title. /// public Window (String title) : this () { this.Title = title; } /// /// AllowGrow Property /// /// /// /// Indicates if the Window can be resized to larger than /// the default size. /// public bool AllowGrow { get { Value val = new Value ( TypeFundamentals.TypeBoolean); GetProperty ("allow-grow", val); return ((bool) val); } set { Value val = new Value (value); SetProperty ("allow-grow", val); } } /// /// AllowShrink Property /// /// /// /// Indicates if the Window can be resized to smaller than /// the default size. /// public bool AllowShrink { get { Value val = new Value ( TypeFundamentals.TypeBoolean); GetProperty ("allow-shrink", val); return ((bool) val); } set { Value val = new Value (value); SetProperty ("allow-shrink", val); } } /* /// /// DefaultSize Property /// /// /// /// The default Size of the Window in Screen Coordinates. /// public Size DefaultSize { get { GValue val = GetProp ("default-size"); return (val != 0); } set { SetProp ("default-size", new GValue (value)); } } */ /// /// DestroyWithParent Property /// /// /// /// Indicates if the Window should be destroyed when any /// associated parent Windows are destroyed. /// public bool DestroyWithParent { get { Value val = new Value ( TypeFundamentals.TypeBoolean); GetProperty ("destroy-with-parent", val); return ((bool) val); } set { Value val = new Value (value); SetProperty ("destroy-with-parent", val); } } /// /// Modal Property /// /// /// /// Indicates if the Window is Modal. If true, the input /// focus is grabbed by the Window and other Windows in /// the application will not accept input until the Window /// is closed. /// public bool Modal { get { Value val = new Value ( TypeFundamentals.TypeBoolean); GetProperty ("modal", val); return ((bool) val); } set { Value val = new Value (value); SetProperty ("modal", val); } } /// /// Position Property /// /// /// /// The Position of the Window in Screen Coordinates. /// [DllImport("gtk-1.3.dll")] static extern void gtk_window_set_position (IntPtr hnd, int x, int y); public Point Position { set { gtk_window_set_position ( RawObject, value.X, value.Y); } } /// /// Resizable Property /// /// /// /// Indicates if the Height and Width of the Window can be /// altered by the user. /// public bool Resizable { get { Value val = new Value ( TypeFundamentals.TypeBoolean); GetProperty ("resizable", val); return ((bool) val); } set { Value val = new Value (value); SetProperty ("resizable", val); } } /// /// Title Property /// /// /// /// The Title displayed in the Window's Title Bar. /// [DllImport("gobject-1.3.dll")] static extern void g_object_set (IntPtr obj, String name, IntPtr val, IntPtr term); public String Title { set { g_object_set (RawObject, "title", Marshal.StringToHGlobalAnsi (value), new IntPtr (0)); /* FIXME: When the String value setting problem is solved. Value val = new Value (value); SetProperty ("title", val); */ } } } }