2008-12-21 19:17:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifndef ADVENTUREMAPBUTTON_H 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define ADVENTUREMAPBUTTON_H 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifdef _MSC_VER 
  
						 
					
						
							
								
									
										
										
										
											2008-01-10 19:01:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# pragma once 
  
						 
					
						
							
								
									
										
										
										
											2008-12-21 19:17:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-03-16 00:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "CPlayerInterface.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-08-15 12:11:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "client/FunctionList.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-05-18 17:33:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <boost/bind.hpp> 
  
						 
					
						
							
								
									
										
										
										
											2008-11-12 18:26:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								namespace  config { struct  ButtonInfo ; }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-03-16 00:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  AdventureMapButton   
						 
					
						
							
								
									
										
										
										
											2008-11-01 22:32:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									:  public  ClickableR ,  public  Hoverable ,  public  KeyShortcut ,  public  CButtonBase 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-16 00:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
									
										
										
										
											2008-08-28 17:36:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									std : : map < int , std : : string >  hoverTexts ;  //state -> text for statusbar
 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-16 00:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									std : : string  helpBox ;  //for right-click help
 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-15 12:11:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CFunctionList < void ( ) >  callback ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-27 10:19:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  colorChange ,  blocked , 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-04 17:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										actOnDown ;  //runs when mouse is pressed down over it, not when up
 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-16 00:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  clickRight  ( tribool  down ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-28 17:36:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									virtual  void  clickLeft  ( tribool  down ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  hover  ( bool  on ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  block ( bool  on ) ;  //if button is blocked then it'll change it's graphic to inactive (offset==2) and won't react on l-clicks
 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-16 00:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  activate ( ) ;  // makes button active
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  deactivate ( ) ;  // makes button inactive (but doesn't delete)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									AdventureMapButton ( ) ;  //c-tor
 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-19 13:17:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AdventureMapButton (  const  std : : map < int , std : : string >  & ,  const  std : : string  & HelpBox ,  const  CFunctionList < void ( ) >  & Callback ,  int  x ,  int  y ,  const  std : : string  & defName ,  int  key = 0 ,  std : : vector < std : : string >  *  add  =  NULL ,  bool  playerColoredButton  =  false  ) ; //c-tor
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									AdventureMapButton (  const  std : : string  & Name ,  const  std : : string  & HelpBox ,  const  CFunctionList < void ( ) >  & Callback ,  int  x ,  int  y ,  const  std : : string  & defName ,  int  key = 0 ,  std : : vector < std : : string >  *  add  =  NULL ,  bool  playerColoredButton  =  false  ) ; //c-tor
 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-12 18:26:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AdventureMapButton (  const  std : : string  & Name ,  const  std : : string  & HelpBox ,  const  CFunctionList < void ( ) >  & Callback ,  config : : ButtonInfo  * info ,  int  key = 0 ) ; //c-tor
 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-25 10:25:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									//AdventureMapButton( std::string Name, std::string HelpBox, boost::function<void()> Callback, int x, int y, std::string defName, bool activ=false,  std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor
 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-15 12:11:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-10-19 13:17:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  init ( const  CFunctionList < void ( ) >  & Callback ,  const  std : : map < int , std : : string >  & Name ,  const  std : : string  & HelpBox ,  bool  playerColoredButton ,  const  std : : string  & defName ,  std : : vector < std : : string >  *  add ,  int  x ,  int  y ,  int  key  ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-28 17:36:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  CHighlightableButton   
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									:  public  AdventureMapButton 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
									
										
										
										
											2008-10-19 13:17:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CHighlightableButton ( const  CFunctionList < void ( ) >  & onSelect ,  const  CFunctionList < void ( ) >  & onDeselect ,  const  std : : map < int , std : : string >  & Name ,  const  std : : string  & HelpBox ,  bool  playerColoredButton ,  const  std : : string  & defName ,  std : : vector < std : : string >  *  add ,  int  x ,  int  y ,  int  key = 0  ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-19 08:16:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  selected ,  onlyOn ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-28 17:36:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CFunctionList < void ( ) >  callback2 ;  //when disselecting
 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-18 13:54:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  select ( bool  on ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-28 17:36:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  clickLeft  ( tribool  down ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-16 00:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 08:15:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  CHighlightableButtonsGroup  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CFunctionList2 < void ( int ) >  onChange ;  //called when changing selected button with new button's id
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									std : : vector < CHighlightableButton * >  buttons ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//void addButton(const std::map<int,std::string> &tooltip, const std::string &HelpBox, const std::string &defName, int x, int y, int uid);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  addButton ( CHighlightableButton *  bt ) ; //add existing button, it'll be deleted by CHighlightableButtonsGroup destructor
 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-19 13:17:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  addButton ( const  std : : map < int , std : : string >  & tooltip ,  const  std : : string  & HelpBox ,  const  std : : string  & defName ,  int  x ,  int  y ,  int  uid ,  const  CFunctionList < void ( ) >  & OnSelect = 0 ,  int  key = 0 ) ;  //creates new button
 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-24 08:15:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CHighlightableButtonsGroup ( const  CFunctionList2 < void ( int ) >  & OnChange ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									~ CHighlightableButtonsGroup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  activate ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  deactivate ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  select ( int  id ,  bool  mode ) ;  //mode==0: id is serial; mode==1: id is unique button id
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  selectionChanged ( int  to ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  show ( SDL_Surface  *  to  =  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-01-31 21:35:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-04 17:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  CSlider  :  public  IShowable ,  public  MotionInterested ,  public  ClickableL  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
									
										
										
										
											2008-05-18 17:33:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AdventureMapButton  left ,  right ,  slider ;  //if vertical then left=up
 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-04 17:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  capacity , //how many elements can be active at same time
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										amount ,  //how many elements
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										value ;  //first active element
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  horizontal ,  moving ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CDefEssential  * imgs  ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-05-18 17:33:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									boost : : function < void ( int ) >  moved ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//void(T::*moved)(int to);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//T* owner;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-04 17:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  redrawSlider ( ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  sliderClicked ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  moveLeft ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  clickLeft  ( tribool  down ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-25 14:09:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  mouseMoved  ( const  SDL_MouseMotionEvent  &  sEvent ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-04 17:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  moveRight ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  moveTo ( int  to ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-07 03:38:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  block ( bool  on ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-04 17:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  activate ( ) ;  // makes button active
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  deactivate ( ) ;  // makes button inactive (but doesn't delete)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  show ( SDL_Surface  *  to  =  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-05-18 17:33:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CSlider ( int  x ,  int  y ,  int  totalw ,  boost : : function < void ( int ) >  Moved ,  int  Capacity ,  int  Amount ,  
							 
						 
					
						
							
								
									
										
										
										
											2008-04-04 17:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  Value = 0 ,  bool  Horizontal = true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									~ CSlider ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ; 	 
						 
					
						
							
								
									
										
										
										
											2008-12-21 19:17:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif  //ADVENTUREMAPBUTTON_H