2005-01-03 Mike Kestner <mkestner@novell.com>

* gtk/NodeStore.cs : expose TreeModelFlags.ListOnly if the TreeNode
	has ListOnly set.
	* gtk/TreeNodeAttribute.cs : add ListOnly named value.

svn path=/trunk/gtk-sharp/; revision=38282
This commit is contained in:
Mike Kestner 2005-01-03 18:37:08 +00:00
parent 8b2b88122b
commit 2871d80ab2
5 changed files with 66 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2005-01-03 Mike Kestner <mkestner@novell.com>
* gtk/NodeStore.cs : expose TreeModelFlags.ListOnly if the TreeNode
has ListOnly set.
* gtk/TreeNodeAttribute.cs : add ListOnly named value.
2004-12-30 Mike Kestner <mkestner@novell.com>
* glib/Object.cs : mark the Data hashtable obsolete.

View File

@ -1,3 +1,7 @@
2005-01-03 Mike Kestner <mkestner@novell.com>
* en/Gtk/TreeNodeAttribute.xml : document ListOnly and add example.
2005-01-03 Shane Landrum <epicene@pobox.com>
* en/Gtk/DrawingArea.xml

View File

@ -30,7 +30,22 @@
}
</code>
</example></para>
</example>
</para>
<para>
In the following example, the class MyListNode is tagged as
a node with 2 columns and no child nodes:
<example>
<code lang="C#">
[TreeNode(ColumnCount=2, ListOnly=true)]
public class MyListNode : ITreeNode {
...
}
</code>
</example>
</para>
</remarks>
</Docs>
<Base>
@ -72,5 +87,22 @@
</remarks>
</Docs>
</Member>
<Member MemberName="ListOnly">
<MemberSignature Language="C#" Value="public bool ListOnly { set; get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>ListOnly named value.</summary>
<returns>a <see cref="T:System.Boolean" /></returns>
<remarks>
Specifies if the node can have children. For list views, this tells the
NodeStore that it is non-hierarchical and it can expose flags so that the
NodeView doesn't include space for expanders in the column layout.
</remarks>
</Docs>
</Member>
</Members>
</Type>
</Type>

View File

@ -1,8 +1,8 @@
// NodeStore.cs - Tree store implementation for TreeView.
//
// Author: Mike Kestner <mkestner@ximian.com>
// Author: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2003 Novell, Inc.
// Copyright (c) 2003-2005 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
@ -83,12 +83,16 @@ namespace Gtk {
GLib.GType[] ctypes;
PropertyInfo[] getters;
int n_cols = 1;
bool list_only = false;
ArrayList nodes = new ArrayList ();
TreeModelIfaceDelegates tree_model_iface;
int get_flags_cb ()
{
return (int) TreeModelFlags.ItersPersist;
TreeModelFlags result = TreeModelFlags.ItersPersist;
if (list_only)
result |= TreeModelFlags.ListOnly;
return (int) result;
}
int get_n_columns_cb ()
@ -281,8 +285,10 @@ namespace Gtk {
void ScanType (Type type)
{
foreach (TreeNodeAttribute attr in type.GetCustomAttributes (typeof (TreeNodeAttribute), false))
foreach (TreeNodeAttribute attr in type.GetCustomAttributes (typeof (TreeNodeAttribute), false)) {
n_cols = attr.ColumnCount;
list_only = attr.ListOnly;
}
ctypes = new GLib.GType [n_cols];
getters = new PropertyInfo [n_cols];

View File

@ -1,8 +1,8 @@
// TreeNodeAttribute.cs - Attribute to specify TreeNode information for a class
//
// Author: Mike Kestner <mkestner@ximian.com>
// Author: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2003 Novell, Inc.
// Copyright (c) 2003-2005 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
@ -26,6 +26,7 @@ namespace Gtk {
[AttributeUsage(AttributeTargets.Class)]
public sealed class TreeNodeAttribute : Attribute {
int col_count;
bool list_only;
public int ColumnCount {
get {
@ -35,6 +36,15 @@ namespace Gtk {
col_count = value;
}
}
public bool ListOnly {
get {
return list_only;
}
set {
list_only = value;
}
}
}
}