00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 package com.realtime.crossfire.jxclient.skin.events;
00023
00024 import com.realtime.crossfire.jxclient.gui.commandlist.CommandList;
00025 import com.realtime.crossfire.jxclient.map.MapScrollListener;
00026 import com.realtime.crossfire.jxclient.map.MapUpdaterState;
00027 import org.jetbrains.annotations.NotNull;
00028
00034 public class MapScrollSkinEvent implements SkinEvent {
00035
00039 @NotNull
00040 private final CommandList commandList;
00041
00045 @NotNull
00046 private final MapUpdaterState mapUpdaterState;
00047
00051 @NotNull
00052 private final MapScrollListener mapscrollListener = new MapScrollListener() {
00053
00054 @Override
00055 public void mapScrolled(final int dx, final int dy) {
00056 commandList.execute();
00057 }
00058
00059 };
00060
00066 public MapScrollSkinEvent(@NotNull final CommandList commandList, @NotNull final MapUpdaterState mapUpdaterState) {
00067 this.commandList = commandList;
00068 this.mapUpdaterState = mapUpdaterState;
00069 this.mapUpdaterState.addCrossfireMapScrollListener(mapscrollListener);
00070 }
00071
00075 @Override
00076 public void dispose() {
00077 mapUpdaterState.removeCrossfireMapScrollListener(mapscrollListener);
00078 }
00079
00080 }