[f-spot: 4/41] Some selection and pixbuf stuffs



commit ada2e0e5715a5e2f18e3e8b87603cc4907d05cb4
Author: Stephane Delcroix <stephane delcroix org>
Date:   Sun Jun 7 09:20:01 2009 +0200

    Some selection and pixbuf stuffs

 src/Widgets/ImageView.cs |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)
---
diff --git a/src/Widgets/ImageView.cs b/src/Widgets/ImageView.cs
index 03d2918..cbc0b8c 100644
--- a/src/Widgets/ImageView.cs
+++ b/src/Widgets/ImageView.cs
@@ -33,9 +33,14 @@ namespace FSpot.Widgets
 			transparent_color = this.Style.BaseColors [(int)Gtk.StateType.Normal];
 		}
 
+		Pixbuf pixbuf;
 		public Pixbuf Pixbuf {
-			get { throw new NotImplementedException ();} 
-			set { throw new NotImplementedException ();} 
+			get { return pixbuf; } 
+			set {
+				pixbuf = value;
+				//scroll_to_view
+				QueueDraw ();
+			} 
 		}
 
 		public int CheckSize {
@@ -48,6 +53,21 @@ namespace FSpot.Widgets
 			set { throw new NotImplementedException ();} 
 		}
 
+		Gdk.Rectangle selection = Rectangle.Zero;
+		public Gdk.Rectangle Selection {
+			get { return selection; }
+			set { 
+				if (value == selection)
+					return;
+
+				selection = value;
+
+				EventHandler eh = SelectionChanged;
+				if (eh != null)
+					eh (this, EventArgs.Empty);
+			}
+		}
+
 		public double SelectionXyRatio {
 			get { throw new NotImplementedException ();} 
 			set { throw new NotImplementedException ();} 
@@ -146,14 +166,25 @@ namespace FSpot.Widgets
 //			return win;
 		}
 
+		[Obsolete ("use the Selection Property")]
 		public bool GetSelection (out int x, out int y, out int width, out int height)
 		{
-			throw new NotImplementedException ();	
+			if (selection == Rectangle.Zero) {
+				x = y = width = height = 0;
+				return false;
+			}
+
+			x = Selection.X;
+			y = Selection.Y;
+			width = Selection.Width;
+			height = Selection.Height;
+			return true;
 		}
 
+		[Obsolete ("set the Selection property to Gdk.Rectangle.Zero instead")]
 		public void UnsetSelection () 
 		{
-			throw new NotImplementedException ();
+			Selection = Gdk.Rectangle.Zero;
 		}
 
 		protected void UpdateMinZoom ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]