[Monodevelop-patches-list] r630 - in trunk/MonoDevelop/src: Libraries/MonoDevelop.Gui/Tree Main/Base/Gui/Pads/ProjectBrowser/BrowserNode
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sat Jan 24 14:10:21 EST 2004
Author: benm
Date: 2004-01-24 14:10:21 -0500 (Sat, 24 Jan 2004)
New Revision: 630
Modified:
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/Tree/TreeNode.cs
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/Tree/TreeView.cs
trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/DirectoryNode.cs
trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/FolderNode.cs
Log:
get folder images working right
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/Tree/TreeNode.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/Tree/TreeNode.cs 2004-01-24 18:15:51 UTC (rev 629)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/Tree/TreeNode.cs 2004-01-24 19:10:21 UTC (rev 630)
@@ -7,7 +7,7 @@
internal TreeNode parent = null;
private TreeNodeCollection nodes;
private string text;
- private Gdk.Pixbuf image;
+ private Gdk.Pixbuf image, opened_image, closed_image;
private object tag;
public TreeNode() {
@@ -36,6 +36,8 @@
public Gdk.Pixbuf Image {
get {
+ if (image == null)
+ return closed_image;
return image;
}
set {
@@ -43,6 +45,26 @@
UpdateBacking ();
}
}
+
+ public Gdk.Pixbuf OpenedImage {
+ get {
+ return opened_image != null ? opened_image : image;
+ }
+ set {
+ opened_image = value;
+ UpdateBacking ();
+ }
+ }
+
+ public Gdk.Pixbuf ClosedImage {
+ get {
+ return closed_image != null ? closed_image : image;
+ }
+ set {
+ closed_image = value;
+ UpdateBacking ();
+ }
+ }
public object Tag {
get {
@@ -74,7 +96,9 @@
return;
TreeView.Model.SetValue (TreeIter, 0, text);
- TreeView.Model.SetValue (TreeIter, 1, image);
+ if (image != null) TreeView.Model.SetValue (TreeIter, 1, image);
+ if (opened_image != null) TreeView.Model.SetValue (TreeIter, 3, opened_image);
+ if (closed_image != null) TreeView.Model.SetValue (TreeIter, 4, closed_image);
}
public TreeNodeCollection Nodes {
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/Tree/TreeView.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/Tree/TreeView.cs 2004-01-24 18:15:51 UTC (rev 629)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/Tree/TreeView.cs 2004-01-24 19:10:21 UTC (rev 630)
@@ -16,7 +16,14 @@
}
public TreeView(bool canEdit) {
- store = new Gtk.TreeStore(typeof(string), typeof(Gdk.Pixbuf), typeof(TreeNode));
+ /*
+ 0 -- Text
+ 1 -- Icon
+ 2 -- Node
+ 3 -- Expanded Icon
+ 4 -- Unexpanded Icon
+ */
+ store = new Gtk.TreeStore(typeof(string), typeof(Gdk.Pixbuf), typeof(TreeNode), typeof(Gdk.Pixbuf), typeof(Gdk.Pixbuf));
this.Model = store;
this.canEdit = canEdit;
@@ -29,6 +36,8 @@
Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf ();
complete_column.PackStart (pix_render, false);
complete_column.AddAttribute (pix_render, "pixbuf", 1);
+ complete_column.AddAttribute (pix_render, "pixbuf-expander-open", 3);
+ complete_column.AddAttribute (pix_render, "pixbuf-expander-closed", 4);
text_render = new Gtk.CellRendererText ();
if (canEdit) {
@@ -119,14 +128,14 @@
internal void UpdateStore(Gtk.TreeStore store) {
store.Clear();
foreach (TreeNode node in nodes) {
- Gtk.TreeIter it = store.AppendValues(node.Text, node.Image, node);
+ Gtk.TreeIter it = store.AppendValues(node.Text, node.Image, node, node.OpenedImage, node.ClosedImage);
AddNodesRecursively(store, it, node);
}
}
private void AddNodesRecursively(Gtk.TreeStore store, Gtk.TreeIter it, TreeNode node) {
foreach(TreeNode nod in node.Nodes) {
- Gtk.TreeIter i = store.AppendValues(it, nod.Text, nod.Image, nod);
+ Gtk.TreeIter i = store.AppendValues(it, nod.Text, nod.Image, nod, nod.OpenedImage, nod.ClosedImage);
AddNodesRecursively(store, i, nod);
}
}
@@ -135,7 +144,7 @@
if (parent.TreeView != this) {
throw new Exception("Wrong tree");
}
- Gtk.TreeIter i = store.AppendValues(parent.TreeIter, child.Text, child.Image, child);
+ Gtk.TreeIter i = store.AppendValues(parent.TreeIter, child.Text, child.Image, child, child.OpenedImage, child.ClosedImage);
AddNodesRecursively(store, i, child);
}
@@ -150,7 +159,7 @@
private void OnNodeInserted(TreeNode node) {
node.treeView = this;
node.parent = null;
- Gtk.TreeIter i = store.AppendValues(node.Text, node.Image, node);
+ Gtk.TreeIter i = store.AppendValues(node.Text, node.Image, node, node.OpenedImage, node.ClosedImage);
AddNodesRecursively(store, i, node);
}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/DirectoryNode.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/DirectoryNode.cs 2004-01-24 18:15:51 UTC (rev 629)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/DirectoryNode.cs 2004-01-24 19:10:21 UTC (rev 630)
@@ -50,8 +50,8 @@
canLabelEdited = true;
contextmenuAddinTreePath = defaultContextMenuPath;
ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
- //OpenedImage = resourceService.GetBitmap("Icons.16x16.OpenFolderBitmap");
- //ClosedImage = resourceService.GetBitmap("Icons.16x16.ClosedFolderBitmap");
+ OpenedImage = resourceService.GetBitmap("Icons.16x16.OpenFolderBitmap");
+ ClosedImage = resourceService.GetBitmap("Icons.16x16.ClosedFolderBitmap");
}
/*
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/FolderNode.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/FolderNode.cs 2004-01-24 18:15:51 UTC (rev 629)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/FolderNode.cs 2004-01-24 19:10:21 UTC (rev 630)
@@ -24,51 +24,10 @@
/// </summary>
public class FolderNode : AbstractBrowserNode
{
- Gdk.Pixbuf closedImage = null;
- Gdk.Pixbuf openedImage = null;
-
- public Gdk.Pixbuf ClosedImage {
- get {
- return closedImage;
- }
- set {
- closedImage = value;
- if (!IsExpanded) {
- IconImage = closedImage;
- }
- }
- }
-
- public Gdk.Pixbuf OpenedImage {
- get {
- return openedImage;
- }
- set {
- openedImage = value;
- if (IsExpanded) {
- IconImage = openedImage;
- }
- }
- }
-
public FolderNode(string nodeName)
{
Text = nodeName;
canLabelEdited = false;
}
-
- public override void BeforeExpand()
- {
- if (openedImage != null) {
- IconImage = openedImage;
- }
- }
-
- public override void BeforeCollapse()
- {
- if (closedImage != null) {
- IconImage = closedImage;
- }
- }
}
}
More information about the Monodevelop-patches-list
mailing list