Ryujinx-GtkSharp/gtk/Window.cs
Mike Kestner 25000abee7 2001-09-27 Mike Kestner <mkestner@speakeasy.net>
*.cs : Added .dll extension to a load of DllImports.
	* makefile : now can make the project with one make windows and on
	both NT and Win98.
	* gdk/Event.cs : Fixed some invalid symbol names and commented out a
	load of stuff.
	* gdk/SimpleEvent.cs : Relocated file from unnecessary subdir and fixed
	several event keyword clashing bugs. Need to relocate the EventArgs
	class out of here into its own file. Fixed loads of typos.
	* glib/Object.cs : Killed the Constructor, this should be a purely
	abstract class. made Events property public until I can fix the Signal
	proxying system's broken reliance on it.
	* glib/SimpleSignal.cs : Relocated, namespaces, and named this Class.
	Loads of bugfixes. Still doesn't work worth a damn, but it builds.
	* glib/TypeFundamentals.cs : New enum for use in the Value code.
	* glib/Value.cs : Implemented a more opaque approach with heap allocated
	memory and g_value_init and friends.  Still doesn't work.  Will probably
	switch to a more C# like approach and avoid GValues altogether.
	* gtk/Button.cs : Commented out some brokeness until I can get around
	to fixing it later.
	* gtk/Widget.cs : Commented out a bunch of the new signal stuff until
	I get around to it.
	* gtk/Window.cs (Title): using g_object_set until I work out the
	details of the new Value/SetProperty system.  It looks like g_object_set
	will end up being easier to use via PInvoke.

svn path=/trunk/gtk-sharp/; revision=1008
2001-09-27 17:17:33 +00:00

201 lines
3.7 KiB
C#
Executable File

// Gtk.Window.cs - GTK Window class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (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 {
/// <summary>
/// Window Object Constructor
/// </summary>
///
/// <remarks>
/// Constructs a Window Wrapper.
/// </remarks>
public Window (IntPtr o)
{
RawObject = o;
}
/// <summary>
/// Window Constructor
/// </summary>
///
/// <remarks>
/// Constructs a new Window of type TopLevel.
/// </remarks>
[DllImport("gtk-1.3.dll")]
static extern IntPtr gtk_window_new (WindowType type);
public Window ()
{
RawObject = gtk_window_new (WindowType.TopLevel);
}
/// <summary>
/// Window Constructor
/// </summary>
///
/// <remarks>
/// Constructs a new Window of type TopLevel with the
/// specified Title.
/// </remarks>
public Window (String title) : this ()
{
this.Title = title;
}
/*
/// <summary>
/// AllowGrow Property
/// </summary>
///
/// <remarks>
/// Indicates if the Window can be resized to larger than
/// the default size.
/// </remarks>
public bool AllowGrow {
get {
Value val = GetProp ("allow-grow");
return (val != 0);
}
set {
SetProp ("allow-grow", new GValue (value));
}
}
/// <summary>
/// AllowShrink Property
/// </summary>
///
/// <remarks>
/// Indicates if the Window can be resized to smaller than
/// the default size.
/// </remarks>
public bool AllowShrink {
get {
GValue val = GetProp ("allow-shrink");
return (val != 0);
}
set {
SetProp ("allow-shrink", new GValue (value));
}
}
/// <summary>
/// DefaultSize Property
/// </summary>
///
/// <remarks>
/// The default Size of the Window in Screen Coordinates.
/// </remarks>
public Size DefaultSize {
get {
GValue val = GetProp ("default-size");
return (val != 0);
}
set {
SetProp ("default-size", new GValue (value));
}
}
/// <summary>
/// DestroyWithParent Property
/// </summary>
///
/// <remarks>
/// Indicates if the Window should be destroyed when any
/// associated parent Windows are destroyed.
/// </remarks>
public bool DestroyWithParent {
get {
GValue val = GetProp ("allow-grow");
return (val != 0);
}
set {
SetProp ("allow-grow", new GValue (value));
}
}
/// <summary>
/// IsModal Property
/// </summary>
///
/// <remarks>
/// 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.
/// </remarks>
public bool IsModal {
get {
GValue val = GetProp ("allow-grow");
return (val != 0);
}
set {
SetProp ("allow-grow", new GValue (value));
}
}
*/
/// <summary>
/// Position Property
/// </summary>
///
/// <remarks>
/// The Position of the Window in Screen Coordinates.
/// </remarks>
[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);
}
}
/// <summary>
/// Title Property
/// </summary>
///
/// <remarks>
/// The Title displayed in the Window's Title Bar.
/// </remarks>
[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));
}
}
}
}