00001 00002 /*************************************************************************** 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 ***************************************************************************/ 00010 00011 #include "targetcoordinatelocator.h" 00012 #include "../dialogs/fieldmarker.h" 00013 #include "../spfst.h" 00014 #include "../mainscreenwidget.h" 00015 #include "../mapdisplay.h" 00016 #include "../iconrepository.h" 00017 00018 00019 00020 SDL_Surface* TargetCoordinateLocator :: getImage() 00021 { 00022 return IconRepository::getIcon("target.png").getBaseSurface(); 00023 }; 00024 bool TargetCoordinateLocator :: eventMouseButtonDown (const SDL_MouseButtonEvent *button) 00025 { 00026 if ( button->button == 3 ) { 00027 SelectFromMap sfm( positions, actmap, false, true); 00028 sfm.Show(); 00029 sfm.RunModal(); 00030 } 00031 if ( button->button == 1 ) { 00032 MapDisplayPG* md = getMainScreenWidget()->getMapDisplay(); 00033 md->cursor.goTo( *positions.begin() ); 00034 } 00035 00036 return true; 00037 } 00038 00039 TargetCoordinateLocator::TargetCoordinateLocator(PG_Widget* parent, const PG_Point& pos, const SelectFromMap::CoordinateList& coordinates ) : PG_Image( parent, pos, getImage(), false ) 00040 { 00041 positions = coordinates; 00042 } 00043
1.4.2