diff --git a/Makefile.am b/Makefile.am index decd152d7..ed42497db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = sources generator parser glib gio cairo pango atk gdk gtk gtkdotnet doc +SUBDIRS = sources generator parser glib gio cairo pango atk gdk gtk gtkdotnet sample doc EXTRA_DIST = \ gtk-sharp.snk \ diff --git a/sample/Actions.cs b/sample/Actions.cs index 00df98071..cc25aaaa7 100644 --- a/sample/Actions.cs +++ b/sample/Actions.cs @@ -313,8 +313,8 @@ namespace GtkSamples { { if (args.Proxy is MenuItem) { actions[args.Proxy] = args.Action; - ((Item)args.Proxy).Selected += new EventHandler (OnSelect); - ((Item)args.Proxy).Deselected += new EventHandler (OnDeselect); + ((MenuItem)args.Proxy).Selected += new EventHandler (OnSelect); + ((MenuItem)args.Proxy).Deselected += new EventHandler (OnDeselect); } } diff --git a/sample/Makefile.am b/sample/Makefile.am index 30cfcd05c..7783ae83e 100755 --- a/sample/Makefile.am +++ b/sample/Makefile.am @@ -8,7 +8,7 @@ DOTNET_TARGETS= DOTNET_ASSEMBLY= endif -TARGETS = gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe treemodeldemo.exe testdnd.exe actions.exe spawn.exe assistant.exe registerprop.exe gexceptiontest.exe cairo-sample.exe native-instantiation.exe polarfixed.exe custom-widget.exe custom-cellrenderer.exe scribble.exe scribble-xinput.exe $(DOTNET_TARGETS) +TARGETS = gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe treemodeldemo.exe actions.exe spawn.exe assistant.exe registerprop.exe gexceptiontest.exe native-instantiation.exe polarfixed.exe # cairo-sample.exe custom-widget.exe custom-cellrenderer.exe scribble.exe scribble-xinput.exe testdnd.exe $(DOTNET_TARGETS) DEBUGS = $(addsuffix .mdb, $(TARGETS)) diff --git a/sample/NativeInstantiationTest.cs b/sample/NativeInstantiationTest.cs index 1e53e5da2..08e6a3de4 100755 --- a/sample/NativeInstantiationTest.cs +++ b/sample/NativeInstantiationTest.cs @@ -13,7 +13,7 @@ namespace GtkSharp { [DllImport ("libgobject-2.0.so.0")] static extern IntPtr g_object_new (IntPtr gtype, string prop, string val, IntPtr dummy); - [DllImport ("libgtk-x11-2.0.so.0")] + [DllImport ("libgtk-3.0.so.0")] static extern void gtk_widget_show (IntPtr handle); public static int Main (string[] args) diff --git a/sample/PolarFixed.cs b/sample/PolarFixed.cs index 79c689cea..6b0347eaa 100644 --- a/sample/PolarFixed.cs +++ b/sample/PolarFixed.cs @@ -11,7 +11,7 @@ class PolarFixed : Container { public PolarFixed () { children = new ArrayList (); - WidgetFlags |= WidgetFlags.NoWindow; + HasWindow = false; } // The child properties object @@ -112,7 +112,21 @@ class PolarFixed : Container { } // Handle size request - protected override void OnSizeRequested (ref Requisition req) + protected override void OnGetPreferredHeight (out int minimal_height, out int natural_height) + { + Requisition req = new Requisition (); + OnSizeRequested (ref req); + minimal_height = natural_height = req.Height; + } + + protected override void OnGetPreferredWidth (out int minimal_width, out int natural_width) + { + Requisition req = new Requisition (); + OnSizeRequested (ref req); + minimal_width = natural_width = req.Width; + } + + void OnSizeRequested (ref Requisition req) { Requisition childReq; int x, y; @@ -171,7 +185,7 @@ class PolarFixed : Container { allocation.Y = cy - y; allocation.Height = childReq.Height; - pfc.Child.Allocation = allocation; + pfc.Child.SizeAllocate (allocation); } } } diff --git a/sample/TreeModelDemo.cs b/sample/TreeModelDemo.cs index ddc23613a..4a67e4877 100644 --- a/sample/TreeModelDemo.cs +++ b/sample/TreeModelDemo.cs @@ -215,6 +215,37 @@ namespace GtkSamples { return false; } + public bool IterPrevious (ref TreeIter iter) + { + object node = NodeFromIter (iter); + if (node == null) + return false; + + int idx; + if (node is Assembly) { + idx = Array.IndexOf (assemblies, node) - 1; + if (idx >= 0) { + iter = IterFromNode (assemblies [idx]); + return true; + } + } else if (node is Type) { + Type[] siblings = (node as Type).Assembly.GetTypes (); + idx = Array.IndexOf (siblings, node) - 1; + if (idx >= 0) { + iter = IterFromNode (siblings [idx]); + return true; + } + } else { + MemberInfo[] siblings = (node as MemberInfo).ReflectedType.GetMembers (); + idx = Array.IndexOf (siblings, node) - 1; + if (idx >= 0) { + iter = IterFromNode (siblings [idx]); + return true; + } + } + return false; + } + int ChildCount (object node) { if (node is Assembly)