diff --git a/ChangeLog b/ChangeLog index bea77da5a..7cf5098c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-03-16 Mike Kestner + + * gtk/NodeSelection.cs: use new Adapter prop on NodeStore. + * gtk/NodeStore.cs: some encapsulation rework. + * gtk/NodeView.cs: use new Adapter prop on NodeStore. new methods + to support manipulation of the view by TreeNode, like scrolling + and cell bounds lookups. + * gtk/TreeView.cs: use new Adapter prop on NodeStore. + * doc/en/Gtk/NodeView.xml: new doc updates. + Patch provided by Vladimir Giszpenc. [Fixes #480067] + 2009-03-07 Mike Kestner * configure.in.in: add --disable-glade-sharp configure option diff --git a/doc/en/Gtk/NodeView.xml b/doc/en/Gtk/NodeView.xml index 4bbb3032d..5fe34064e 100644 --- a/doc/en/Gtk/NodeView.xml +++ b/doc/en/Gtk/NodeView.xml @@ -39,7 +39,7 @@ The store containing the view's data. - a + an object of type @@ -52,7 +52,7 @@ Used to obtain and manipulate the currently selected node(s). - a + an object of type @@ -76,6 +76,241 @@ + + + Method + + System.Void + + + + + + + Collapses a row (hides its child rows, if they exist). + an object of type + an object of type + + + + + + + Method + + System.Boolean + + + + + + Activates the cell determined by and . + an object of type identifying the row to be activated + + + + + + + Method + + Gdk.Pixmap + + + + + + This image is used for a drag icon.. + a + + + + + + + Method + + Gdk.Rectangle + + + + + + + Fills the bounding rectangle in tree window coordinates for the cell at the row specified by and the column specified by . + an object of type identifying the row + an object of type identifying the column + See the remark in . + + + + + + + Method + + Gdk.Rectangle + + + + + + + Fills the bounding rectangle in tree window coordinates for the cell at the row specified by and the column specified by . + an object of type identifying the row + an object of type identifying the column + See the remark in . + + + + + + + Method + + Gtk.ITreeNode + + + + + + + Finds the ITreeNode at the point (x, y), relative to widget coordinates. + an X coordinate + an Y coordinate + an object of type + It is primarily for things like popup menus. This function is only meaningful if TreeView is realized. This function can return null. + + + + + + Method + + System.Boolean + + + + + + Returns if the node pointed to by is expanded. + an object of type + a + + + + + + + + Method + + System.Boolean + + + + + + + returns a to the first visible row. + returns a to the last visible row. + Gets the visible rows of the view. + + if the start and end nodes were set. + Note: there may be invisible nodes between the start and end nodes returned. + + + + + + Method + + System.Void + + + + + + + + + + Moves the alignments of the to the position specified by and . + an object of type identifying a row to scroll to + an object of type identifying a column to scroll to + a + a + a + + + If is , then no horizontal scrolling occurs. Likewise, if is no vertical scrolling occurs. At a minimum, one of or need to be non-. determines where the row is placed, and determines where the column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means center. + + + If is , then the alignment arguments are ignored, and the tree does the minimum amount of work to scroll the cell onto the screen. This means that the cell will be scrolled to the edge closest to its current position. If the cell is currently visible on the screen, nothing is done. + + + This function only works if the model is set, and is a valid row on the model. If the model changes before the is realized, the centered path will be modified to reflect this change. + + + + + + + + Method + + System.Void + + + + + + + + + an object of type + an object of type + an object of type + an object of type + Sets the tip area of to the area which cell occupies in the item pointed to by node. See also .. + + + + + + + Method + + System.Void + + + + + + + Expands the row at so its children are visible. + an object of type identifying the row to expand + a to determine whether to recursively expand or just expand immediate children + + + + + + + Method + + System.Void + + + + + + Expands the row at . This will also expand all parent rows of as necessary. + an object of type identifying the row to expand + + + + Constructor diff --git a/gtk/NodeSelection.cs b/gtk/NodeSelection.cs index 734228558..a05af1565 100644 --- a/gtk/NodeSelection.cs +++ b/gtk/NodeSelection.cs @@ -43,7 +43,7 @@ namespace Gtk { public bool NodeIsSelected (ITreeNode node) { - return selection.IterIsSelected (NodeView.NodeStore.Implementor.GetIter (node)); + return selection.IterIsSelected (NodeView.NodeStore.GetIter (node)); } public bool PathIsSelected (TreePath path) @@ -58,7 +58,7 @@ namespace Gtk { public void SelectNode (ITreeNode node) { - selection.SelectIter (NodeView.NodeStore.Implementor.GetIter (node)); + selection.SelectIter (NodeView.NodeStore.GetIter (node)); } public void SelectPath (TreePath path) @@ -68,8 +68,8 @@ namespace Gtk { public void SelectRange (ITreeNode begin_node, ITreeNode end_node) { - TreePath begin = NodeView.NodeStore.Implementor.GetPath (begin_node); - TreePath end = NodeView.NodeStore.Implementor.GetPath (end_node); + TreePath begin = NodeView.NodeStore.GetPath (begin_node); + TreePath end = NodeView.NodeStore.GetPath (end_node); selection.SelectRange (begin, end); } @@ -81,7 +81,7 @@ namespace Gtk { public void UnselectNode (ITreeNode node) { - selection.UnselectIter (NodeView.NodeStore.Implementor.GetIter (node)); + selection.UnselectIter (NodeView.NodeStore.GetIter (node)); } public void UnselectPath (TreePath path) @@ -96,8 +96,8 @@ namespace Gtk { public void UnselectRange (ITreeNode begin_node, ITreeNode end_node) { - TreePath begin = NodeView.NodeStore.Implementor.GetPath (begin_node); - TreePath end = NodeView.NodeStore.Implementor.GetPath (end_node); + TreePath begin = NodeView.NodeStore.GetPath (begin_node); + TreePath end = NodeView.NodeStore.GetPath (end_node); selection.UnselectRange (begin, end); } diff --git a/gtk/NodeStore.cs b/gtk/NodeStore.cs index 4c2a688c2..9c9c4ad34 100644 --- a/gtk/NodeStore.cs +++ b/gtk/NodeStore.cs @@ -28,20 +28,57 @@ namespace Gtk { using System.Runtime.InteropServices; public class NodeStore : GLib.Object, IEnumerable { - internal readonly NodeStoreImplementor Implementor; + + NodeStoreImplementor implementor; public NodeStore (Type node_type) { - Implementor = new NodeStoreImplementor (node_type); + implementor = new NodeStoreImplementor (node_type); } - // Redirect calls to implementor class - public ITreeNode GetNode (TreePath path) { return Implementor.GetNode (path); } - public void AddNode (ITreeNode node) { Implementor.AddNode (node); } - public void AddNode (ITreeNode node, int position) { Implementor.AddNode (node, position); } - public void RemoveNode (ITreeNode node) { Implementor.RemoveNode (node); } - public void Clear () { Implementor.Clear (); } - public IEnumerator GetEnumerator () { return Implementor.GetEnumerator (); } + internal TreeModelAdapter Adapter { + get { return new TreeModelAdapter (implementor); } + } + + internal TreeIter GetIter (ITreeNode node) + { + return implementor.GetIter (node); + } + + internal TreePath GetPath (ITreeNode node) + { + return implementor.GetPath (node); + } + + public ITreeNode GetNode (TreePath path) + { + return implementor.GetNode (path); + } + + public void AddNode (ITreeNode node) + { + implementor.AddNode (node); + } + + public void AddNode (ITreeNode node, int position) + { + implementor.AddNode (node, position); + } + + public void RemoveNode (ITreeNode node) + { + implementor.RemoveNode (node); + } + + public void Clear () + { + implementor.Clear (); + } + + public IEnumerator GetEnumerator () + { + return implementor.GetEnumerator (); + } internal class NodeStoreImplementor : GLib.Object, TreeModelImplementor, IEnumerable { TreeModelAdapter model_adapter; diff --git a/gtk/NodeView.cs b/gtk/NodeView.cs index 4790d7268..2aab11aff 100644 --- a/gtk/NodeView.cs +++ b/gtk/NodeView.cs @@ -30,7 +30,7 @@ namespace Gtk { NodeStore store; NodeSelection selection; - public NodeView (NodeStore store) : base (store == null ? null : new Gtk.TreeModelAdapter (store.Implementor)) + public NodeView (NodeStore store) : base (store == null ? null : store.Adapter) { this.store = store; } @@ -43,7 +43,7 @@ namespace Gtk { } set { store = value; - this.Model = store == null ? null : new Gtk.TreeModelAdapter (store.Implementor); + this.Model = store == null ? null : store.Adapter; } } @@ -65,6 +65,71 @@ namespace Gtk { AppendColumn (col); return col; } + + public void ActivateRow (ITreeNode node, Gtk.TreeViewColumn column) { + ActivateRow (store.GetPath (node), column); + } + + public bool CollapseRow (ITreeNode node) { + return CollapseRow (store.GetPath (node)); + } + + public Gdk.Pixmap CreateRowDragIcon (ITreeNode node) { + return CreateRowDragIcon (store.GetPath (node)); + } + + public Gdk.Rectangle GetBackgroundArea (ITreeNode node, Gtk.TreeViewColumn column) { + return GetBackgroundArea (store.GetPath (node), column); + } + + public Gdk.Rectangle GetCellArea (ITreeNode node, Gtk.TreeViewColumn column) { + return GetBackgroundArea (store.GetPath (node), column); + } + + public ITreeNode GetNodeAtPos (int x, int y) { + Gtk.TreePath nodePath; + ITreeNode node = null; + + if (this.GetPathAtPos (x, y, out nodePath)) + node = store.GetNode (nodePath); + + return node; + } + + public bool GetRowExpanded (ITreeNode node) { + return GetRowExpanded (store.GetPath (node)); + } + + public bool GetVisibleRange (out ITreeNode startNode, out ITreeNode endNode) { + Gtk.TreePath start_path, end_path; + bool retVal = GetVisibleRange (out start_path, out end_path); + if (retVal) { + startNode = store.GetNode (start_path); + endNode = store.GetNode (end_path); + } + else { + startNode = null; + endNode = null; + } + + return retVal; + } + + public void ScrollToCell (ITreeNode node, TreeViewColumn column, bool use_align, float row_align, float col_align) { + ScrollToCell (store.GetPath (node), column, use_align, row_align, col_align); + } + + public void SetTooltipCell (Tooltip tooltip, ITreeNode node, TreeViewColumn column, CellRenderer renderer) { + SetTooltipCell (tooltip, store.GetPath (node), column, renderer); + } + + public void ExpandRow (ITreeNode node, bool open_all) { + ExpandRow (store.GetPath (node), open_all); + } + + public void ExpandToNode (ITreeNode node) { + ExpandToPath (store.GetPath (node)); + } } } diff --git a/gtk/TreeView.custom b/gtk/TreeView.custom index ed5c53447..ffe1583ca 100644 --- a/gtk/TreeView.custom +++ b/gtk/TreeView.custom @@ -25,7 +25,7 @@ [Obsolete ("Use NodeView with NodeStores")] - public TreeView (NodeStore store) : this (store == null ? null : new Gtk.TreeModelAdapter (store.Implementor)) { } + public TreeView (NodeStore store) : this (store == null ? null : store.Adapter) {} public Gdk.Color OddRowColor { get {