2003-03-15 Miguel de Icaza <miguel@ximian.com>

* sample: Update samples to new Glade.Widget.

	* glade/WidgetAttribute.cs: Moved the old GladeWidgetattribute
	here.   Now its called `Glade.WidgetAttribute'.

	* glade/GladeWidgetAttribute.cs: Removed

	* glib/Idle.cs: Do not allow Idle class to be instantiated.

svn path=/trunk/gtk-sharp/; revision=12554
This commit is contained in:
Miguel de Icaza 2003-03-15 21:02:25 +00:00
parent 1c5b25f9a1
commit 215133d780
7 changed files with 30 additions and 12 deletions

View File

@ -1,3 +1,14 @@
2003-03-15 Miguel de Icaza <miguel@ximian.com>
* sample: Update samples to new Glade.Widget.
* glade/WidgetAttribute.cs: Moved the old GladeWidgetattribute
here. Now its called `Glade.WidgetAttribute'.
* glade/GladeWidgetAttribute.cs: Removed
* glib/Idle.cs: Do not allow Idle class to be instantiated.
2003-03-11 Miguel de Icaza <miguel@ximian.com>
* gtk/Application.cs (CurrentEvent): Property implementing the

View File

@ -1,4 +1,4 @@
// GladeWidgetAttribute.cs
// WidgetAttribute.cs
//
// Author: Rachel Hestilow <hestilow@ximian.com>
//
@ -8,18 +8,18 @@ namespace Glade {
using System;
[AttributeUsage (AttributeTargets.Field)]
public class GladeWidgetAttribute : Attribute
public class WidgetAttribute : Attribute
{
private string name;
private bool specified;
public GladeWidgetAttribute (string name)
public WidgetAttribute (string name)
{
specified = true;
this.name = name;
}
public GladeWidgetAttribute ()
public WidgetAttribute ()
{
specified = false;
}

View File

@ -268,12 +268,12 @@
foreach (System.Reflection.FieldInfo field in fields)
{
object[] attrs = field.GetCustomAttributes (typeof (GladeWidgetAttribute), true);
object[] attrs = field.GetCustomAttributes (typeof (WidgetAttribute), true);
if (attrs == null || attrs.Length == 0)
continue;
// The widget to field binding must be 1:1, so only check
// the first attribute.
GladeWidgetAttribute widget = (GladeWidgetAttribute) attrs[0];
WidgetAttribute widget = (WidgetAttribute) attrs[0];
if (widget.Specified) field.SetValue (target, GetWidget (widget.Name), flags, null, null);
else field.SetValue (target, GetWidget (field.Name), flags, null, null);
}

View File

@ -33,6 +33,10 @@ namespace GLib {
public class Idle {
private Idle ()
{
}
[DllImport("libglib-2.0-0.dll")]
static extern uint g_idle_add (IdleHandler d, IntPtr data);

View File

@ -165,7 +165,7 @@ class Client {
t.Attach (label, 2, 3, 0, 1);
}
static void Db_Insert (Gtk.Object o)
static void Db_Insert ()
{
if (dialog != null) {
return;
@ -384,17 +384,17 @@ class Client {
static void Insert_Activated (object o, EventArgs args)
{
Db_Insert (o as Gtk.Object);
Db_Insert ();
}
static void Remove_Activated (object o, EventArgs args)
{
Db_Remove (o as Gtk.Object);
Db_Remove ();
}
static void Update_Activated (object o, EventArgs args)
{
Db_Update (o as Gtk.Object);
Db_Update ();
}
static void Quit_Activated (object o, EventArgs args)

View File

@ -16,7 +16,7 @@ namespace GladeSamples {
public class GladeTest : Program
{
[GladeWidget("main_window")]
[Glade.Widget("main_window")]
Gtk.Window main_window;
public static void Main (string[] args)
@ -34,7 +34,7 @@ namespace GladeSamples {
if (main_window != null)
Console.WriteLine ("Main Window Title: \"{0}\"", main_window.Title);
else
Console.WriteLine ("GladeWidgetAttribute is broken.");
Console.WriteLine ("WidgetAttribute is broken.");
}
public void OnWindowDeleteEvent (object o, DeleteEventArgs args)

View File

@ -69,10 +69,13 @@ namespace GtkSamples {
Gdk.EventConfigure ev = args.Event;
Gdk.Window window = ev.window;
Gdk.Rectangle allocation = darea.Allocation;
Console.WriteLine ("Darea=[{0}]" , darea);
pixmap = new Gdk.Pixmap (window,
allocation.width,
allocation.height,
-1);
Console.WriteLine ("Darea.Style={0}", darea.Style);
pixmap.DrawRectangle (darea.Style.WhiteGC, 1, 0, 0,
allocation.width, allocation.height);