[ease] Allow entry of newline characters in TextActor.



commit b01a0e41707732c4d3b2456587a167df97aa2830
Author: Nate Stedman <natesm gmail com>
Date:   Thu Jun 10 21:53:57 2010 -0400

    Allow entry of newline characters in TextActor.

 src/TextActor.vala |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/TextActor.vala b/src/TextActor.vala
index 72ceb2a..7a447b7 100644
--- a/src/TextActor.vala
+++ b/src/TextActor.vala
@@ -63,7 +63,9 @@ public class Ease.TextActor : Actor
 		var text = contents as Clutter.Text;
 		text.editable = true;
 		text.reactive = true;
+		text.activatable = true;
 		text.text_changed.connect(text_changed);
+		text.activate.connect(text_activate);
 		
 		// grab key focus
 		((Clutter.Stage)get_stage()).set_key_focus(text);
@@ -82,7 +84,9 @@ public class Ease.TextActor : Actor
 		var text = contents as Clutter.Text;
 		text.editable = false;
 		text.reactive = false;
+		text.activatable = false;
 		text.text_changed.disconnect(text_changed);
+		text.activate.disconnect(text_activate);
 	}
 	
 	/**
@@ -93,5 +97,13 @@ public class Ease.TextActor : Actor
 	{
 		element.set("text", sender.text);
 	}
+	
+	/**
+	 * Signal handler for text "activation", inserts a newline character.
+	 */
+	private void text_activate(Clutter.Text sender)
+	{
+		(contents as Clutter.Text).insert_unichar('\n');
+	}
 }
 



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