More sample build fixes.
* Makefile.am: reenable samples. * sample/Actions.cs: s/Item/MenuItem, Item is dead. * sample/NativeInstantiationTest.cs: fix dllimport, still crashes. * sample/PolarFixed.cs: Fix size negotiation API usage, still crashes. * sample/TreeModelDemo.cs: add ItemPrevious, still crashes. * sample/Makefile.am: comment out some samples that don't build.
This commit is contained in:
parent
ace9176d4a
commit
c09e82a09f
6 changed files with 53 additions and 8 deletions
|
@ -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 = \
|
EXTRA_DIST = \
|
||||||
gtk-sharp.snk \
|
gtk-sharp.snk \
|
||||||
|
|
|
@ -313,8 +313,8 @@ namespace GtkSamples {
|
||||||
{
|
{
|
||||||
if (args.Proxy is MenuItem) {
|
if (args.Proxy is MenuItem) {
|
||||||
actions[args.Proxy] = args.Action;
|
actions[args.Proxy] = args.Action;
|
||||||
((Item)args.Proxy).Selected += new EventHandler (OnSelect);
|
((MenuItem)args.Proxy).Selected += new EventHandler (OnSelect);
|
||||||
((Item)args.Proxy).Deselected += new EventHandler (OnDeselect);
|
((MenuItem)args.Proxy).Deselected += new EventHandler (OnDeselect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ DOTNET_TARGETS=
|
||||||
DOTNET_ASSEMBLY=
|
DOTNET_ASSEMBLY=
|
||||||
endif
|
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))
|
DEBUGS = $(addsuffix .mdb, $(TARGETS))
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace GtkSharp {
|
||||||
[DllImport ("libgobject-2.0.so.0")]
|
[DllImport ("libgobject-2.0.so.0")]
|
||||||
static extern IntPtr g_object_new (IntPtr gtype, string prop, string val, IntPtr dummy);
|
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);
|
static extern void gtk_widget_show (IntPtr handle);
|
||||||
|
|
||||||
public static int Main (string[] args)
|
public static int Main (string[] args)
|
||||||
|
|
|
@ -11,7 +11,7 @@ class PolarFixed : Container {
|
||||||
public PolarFixed ()
|
public PolarFixed ()
|
||||||
{
|
{
|
||||||
children = new ArrayList ();
|
children = new ArrayList ();
|
||||||
WidgetFlags |= WidgetFlags.NoWindow;
|
HasWindow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The child properties object
|
// The child properties object
|
||||||
|
@ -112,7 +112,21 @@ class PolarFixed : Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle size request
|
// 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;
|
Requisition childReq;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
@ -171,7 +185,7 @@ class PolarFixed : Container {
|
||||||
allocation.Y = cy - y;
|
allocation.Y = cy - y;
|
||||||
allocation.Height = childReq.Height;
|
allocation.Height = childReq.Height;
|
||||||
|
|
||||||
pfc.Child.Allocation = allocation;
|
pfc.Child.SizeAllocate (allocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,37 @@ namespace GtkSamples {
|
||||||
return false;
|
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)
|
int ChildCount (object node)
|
||||||
{
|
{
|
||||||
if (node is Assembly)
|
if (node is Assembly)
|
||||||
|
|
Loading…
Reference in a new issue