2001-10-07 Mike Kestner <mkestner@speakeasy.net>
* glib/Object.cs : Added public Handle property. It would be nice if I could make the RawObject public for get and protected for set, but that doesn't appear to be possible with C# properties. * gtk/Container.cs : New class with 2 of the 3 props and the Add/Remove methods only implemented. * gtk/Widget.cs : Added SizeRequest prop which is a combination of HeightRequest and SizeRequest. Embrace and extend gtk... * gtk/Window.cs : Derive from newly added Container subclass. * sample/ButtonApp.cs : Simple tire-kicking app. svn path=/trunk/gtk-sharp/; revision=1112
This commit is contained in:
parent
58dc5f24bf
commit
aa1077bbb1
7 changed files with 203 additions and 5 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2001-10-07 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
|
* glib/Object.cs : Added public Handle property. It would be nice
|
||||||
|
if I could make the RawObject public for get and protected for set,
|
||||||
|
but that doesn't appear to be possible with C# properties.
|
||||||
|
* gtk/Container.cs : New class with 2 of the 3 props and the Add/Remove
|
||||||
|
methods only implemented.
|
||||||
|
* gtk/Widget.cs : Added SizeRequest prop which is a combination of
|
||||||
|
HeightRequest and SizeRequest. Embrace and extend gtk...
|
||||||
|
* gtk/Window.cs : Derive from newly added Container subclass.
|
||||||
|
* sample/ButtonApp.cs : Simple tire-kicking app.
|
||||||
|
|
||||||
2001-10-06 Mike Kestner <mkestner@speakeasy.net>
|
2001-10-06 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
* gtk/Button.cs : Implemented 3 constructors, 5 methods, 4 properties,
|
* gtk/Button.cs : Implemented 3 constructors, 5 methods, 4 properties,
|
||||||
|
|
|
@ -58,8 +58,9 @@ namespace GLib {
|
||||||
///
|
///
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The raw GObject reference associated with this wrapper.
|
/// The raw GObject reference associated with this wrapper.
|
||||||
/// Only subclasses of Object should need to access this
|
/// Only subclasses of Object can access this read/write
|
||||||
/// unmanaged pointer.
|
/// property. For public read-only access, use the
|
||||||
|
/// Handle property.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
protected IntPtr RawObject {
|
protected IntPtr RawObject {
|
||||||
|
@ -72,6 +73,22 @@ namespace GLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle Property
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// The raw GObject reference associated with this object.
|
||||||
|
/// Subclasses can use RawObject property for read/write
|
||||||
|
/// access.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public IntPtr Handle {
|
||||||
|
get {
|
||||||
|
return _obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Events Property
|
/// Events Property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -81,7 +98,7 @@ namespace GLib {
|
||||||
/// object indexed by the Gtk+ signal name.
|
/// object indexed by the Gtk+ signal name.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public EventHandlerList Events {
|
protected EventHandlerList Events {
|
||||||
get {
|
get {
|
||||||
if (_events == null)
|
if (_events == null)
|
||||||
_events = new EventHandlerList ();
|
_events = new EventHandlerList ();
|
||||||
|
|
100
gtk/Container.cs
Normal file
100
gtk/Container.cs
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
// Gtk.Container.cs - GtkContainer class wrapper implementation
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
//
|
||||||
|
// (c) 2001 Mike Kestner
|
||||||
|
|
||||||
|
namespace Gtk {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Container Class
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Abstract class which provides the capability to embed a
|
||||||
|
/// widget within its boundaries.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public abstract class Container : Widget {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// BorderWidth Property
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// The Width, in pixels, of the border around the
|
||||||
|
/// Container.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public int BorderWidth {
|
||||||
|
get {
|
||||||
|
int val;
|
||||||
|
GetProperty ("border-width", out val);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
SetProperty ("border-width", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: Implement Child property.
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ResizeMode Property
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Indicates the resizing policy for the Container.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public ResizeMode ResizeMode {
|
||||||
|
get {
|
||||||
|
int val;
|
||||||
|
GetProperty ("border-width", out val);
|
||||||
|
return (ResizeMode) val;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
SetProperty ("border-width", (int) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add Method
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Adds a child Widget to the Container.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
|
||||||
|
CallingConvention=CallingConvention.Cdecl)]
|
||||||
|
static extern void gtk_container_add (IntPtr obj, IntPtr child);
|
||||||
|
|
||||||
|
public void Add (Widget child)
|
||||||
|
{
|
||||||
|
gtk_container_add (Handle, child.Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove Method
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Remove a child Widget from the Container.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
|
||||||
|
CallingConvention=CallingConvention.Cdecl)]
|
||||||
|
static extern void gtk_container_remove (IntPtr obj,
|
||||||
|
IntPtr child);
|
||||||
|
|
||||||
|
public void Remove (Widget child)
|
||||||
|
{
|
||||||
|
gtk_container_remove (Handle, child.Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ namespace Gtk {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using GLib;
|
using GLib;
|
||||||
using Gdk;
|
using Gdk;
|
||||||
|
@ -213,6 +214,24 @@ namespace Gtk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SizeRequest Property
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// The desired size in pixels for the widget.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public Size SizeRequest {
|
||||||
|
get {
|
||||||
|
return new Size (WidthRequest, HeightRequest);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
WidthRequest = value.Width;
|
||||||
|
HeightRequest = value.Height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visible Property
|
/// Visible Property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -11,7 +11,15 @@ namespace Gtk {
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public class Window : Widget {
|
/// <summary>
|
||||||
|
/// Window Class
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// A Top Level Window object.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public class Window : Container {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Window Object Constructor
|
/// Window Object Constructor
|
||||||
|
|
41
sample/ButtonApp.cs
Executable file
41
sample/ButtonApp.cs
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
// ButtonApp.cs - Gtk.Button class Test implementation
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
//
|
||||||
|
// (c) 2001 Mike Kestner
|
||||||
|
|
||||||
|
namespace GtkSamples {
|
||||||
|
|
||||||
|
using Gtk;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
public class ButtonApp {
|
||||||
|
|
||||||
|
public static int Main (string[] args)
|
||||||
|
{
|
||||||
|
Application.Init (ref args);
|
||||||
|
Window win = new Window ("Button Tester");
|
||||||
|
win.DeleteEvent += new EventHandler (Window_Delete);
|
||||||
|
Button btn = new Button ();
|
||||||
|
btn.Clicked += new EventHandler (btn_click);
|
||||||
|
btn.SizeRequest = new Size (32, 24);
|
||||||
|
btn.Show ();
|
||||||
|
win.Add (btn);
|
||||||
|
win.Show ();
|
||||||
|
Application.Run ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void btn_click (object obj, EventArgs args)
|
||||||
|
{
|
||||||
|
Console.WriteLine ("Button Clicked");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Window_Delete (object obj, EventArgs args)
|
||||||
|
{
|
||||||
|
Application.Quit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,8 @@ all:
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
$(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll /recurse:*.cs
|
$(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll HelloWorld.cs
|
||||||
|
$(CSC) /unsafe /out:button.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs
|
||||||
|
|
||||||
unix:
|
unix:
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
Loading…
Reference in a new issue