Home | History | Annotate | Download | only in actions
      1 /*******************************************************************************
      2  * Copyright 2011 See AUTHORS file.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *   http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  ******************************************************************************/
     16 
     17 package com.badlogic.gdx.scenes.scene2d.actions;
     18 
     19 import com.badlogic.gdx.scenes.scene2d.Action;
     20 import com.badlogic.gdx.scenes.scene2d.Actor;
     21 import com.badlogic.gdx.scenes.scene2d.EventListener;
     22 
     23 /** Removes a listener from an actor.
     24  * @author Nathan Sweet */
     25 public class RemoveListenerAction extends Action {
     26 	private EventListener listener;
     27 	private boolean capture;
     28 
     29 	public boolean act (float delta) {
     30 		if (capture)
     31 			target.removeCaptureListener(listener);
     32 		else
     33 			target.removeListener(listener);
     34 		return true;
     35 	}
     36 
     37 	public EventListener getListener () {
     38 		return listener;
     39 	}
     40 
     41 	public void setListener (EventListener listener) {
     42 		this.listener = listener;
     43 	}
     44 
     45 	public boolean getCapture () {
     46 		return capture;
     47 	}
     48 
     49 	public void setCapture (boolean capture) {
     50 		this.capture = capture;
     51 	}
     52 
     53 	public void reset () {
     54 		super.reset();
     55 		listener = null;
     56 	}
     57 }
     58