/**
 * Appcelerator Titanium Mobile
 * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */
package ti.modules.titanium.ui;

import org.appcelerator.titanium.TiContext;
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.view.TiUIView;

import ti.modules.titanium.ui.widget.TiUILabel;
import android.app.Activity;

public class LabelProxy extends TiViewProxy
{
	public LabelProxy(TiContext tiContext, Object[] args)
	{
		super(tiContext, args);
	}

	@Override
	public TiUIView createView(Activity activity)
	{
		return new TiUILabel(this);
	}
	
	@Override
	public int addEventListener(String eventName, Object listener) {
		if (eventName.equals("click")) {
			((TiUILabel)getView(getTiContext().getActivity())).setClickable(true);
		}
		return super.addEventListener(eventName, listener);
	}
}

@@ -308,16 +308,58 @@
 ontext;%0A
+import org.appcelerator.titanium.TiProxy;%0A
 import o
@@ -782,16 +782,14 @@
 lic 
-int addE
+void e
 vent
@@ -796,16 +796,21 @@
 Listener
+Added
 (String 
@@ -824,26 +824,91 @@
 me, 
-Object listener) %7B
+int count, TiProxy proxy) %7B%0A%09%09super.eventListenerAdded(eventName, count, proxy);%0A%09%09
 %0A%09%09i
@@ -1022,26 +1022,112 @@
 %09%7D%0A%09
-%09return 
+%7D%0A%09%0A%09@Override%0A%09public void eventListenerRemoved(String eventName, int count, TiProxy proxy) %7B%0A%09%09
 super.
-addE
+e
 vent
@@ -1134,16 +1134,23 @@
 Listener
+Removed
 (eventNa
@@ -1157,18 +1157,153 @@
 me, 
-listener);
+count, proxy);%0A%09%09%0A%09%09if (eventName.equals(%22click%22) && count == 0) %7B%0A%09%09%09((TiUILabel)getView(getTiContext().getActivity())).setClickable(false);%0A%09%09%7D
 %0A%09%7D%0A

set clickable inside the callback for eventListenerAdded, and unset it if/when all listeners have been removed