Advanced Strategic Command
guiiconhandler.cpp
Go to the documentation of this file.
1 
5 /*
6  This file is part of Advanced Strategic Command; http://www.asc-hq.de
7  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING. If not, write to the
21  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22  Boston, MA 02111-1307 USA
23 */
24 
25 #include <stdio.h>
26 #include <cstring>
27 #include <stdlib.h>
28 #include <SDL_image.h>
29 
30 #include "guiiconhandler.h"
31 #include "spfst.h"
32 #include "iconrepository.h"
33 #include "mapdisplay.h"
34 #include "sigc++/retype_return.h"
35 #include "asc-mainscreen.h"
36 #include "gameoptions.h"
37 #include "spfst-legacy.h"
38 
39 const int guiIconSizeX = 49;
40 const int guiIconSizeY = 35;
41 const int guiIconSpace = 5;
42 const int guiIconColumnNum = 3;
43 
44 
45 const int smallGuiIconSizeX = 49;
46 const int smallGuiIconSizeY = 35;
47 const int smallGuiIconSpace = 2;
48 const float smallGuiIconSizeFactor = 1;
49 
50 
51 
52 GuiButton::GuiButton( PG_Widget *parent, const PG_Rect &r ) : PG_Button( parent, r, "", -1, "GuiButton"), func( NULL ), id(-1)
53 {
54  sigClick.connect( sigc::hide( sigc::mem_fun( *this, &GuiButton::exec )));
55  SetBackground( PRESSED, IconRepository::getIcon("empty-pressed.png").getBaseSurface() );
56  SetBackground( HIGHLITED, IconRepository::getIcon("empty-high.png").getBaseSurface() );
57  SetBackground( UNPRESSED, IconRepository::getIcon("empty.png").getBaseSurface() );
58  SetBorderSize(0,0,0);
59 }
60 
62 {
63  if ( func ) {
64  callFunc( pos, subject, id );
65  return true;
66  }
67  return false;
68 }
69 
70 
71 void GuiButton::registerFunc( GuiFunction* f, const MapCoordinate& position, ContainerBase* subject, int id )
72 {
73  this->id = id;
74  this->subject = subject;
75  func = f;
76  pos = position;
77  SetIcon( f->getImage( position, subject, id).getBaseSurface());
78 }
79 
81 {
82  func = NULL;
83  id = 0;
84  subject = NULL;
85  pos = MapCoordinate(-1,-1);
86  SetIcon ( (SDL_Surface*) NULL );
87 }
88 
90 {
91  PG_Button::eventMouseEnter();
92  showInfoText();
93 }
94 
96 {
97  PG_Button::eventMouseLeave();
98  MessagingHub::Instance().statusInformation("");
99 }
100 
101 void GuiButton::callFunc( const MapCoordinate& pos, ContainerBase* subject, int num )
102 {
103  try {
104  func->execute( pos, subject, id );
105  } catch ( ActionResult res ) {
106  errorMessage( res.getMessage() );
107  }
108 }
109 
110 
111 bool GuiButton::checkForKey( const SDL_KeyboardEvent* key, int modifier )
112 {
113  if ( func->available( pos, subject, id ))
114  if ( func->checkForKey( key, modifier, id)) {
115  callFunc( pos, subject, id );
116  return true;
117  }
118  return false;
119 }
120 
122 {
123  if ( func )
124  MessagingHub::Instance().statusInformation( func->getName(pos, subject, id));
125 }
126 
127 
128 
129 SmallGuiButton::SmallGuiButton( PG_Widget *parent, const PG_Rect &r, GuiButton* guiButton, NewGuiHost* host ) : PG_Button( parent, r, "", -1, "GuiButton"), referenceButton( guiButton )
130 {
131  sigClick.connect( sigc::hide( sigc::mem_fun( *host, &NewGuiHost::clearSmallIcons )));
132  sigClick.connect( sigc::hide( sigc::mem_fun( *guiButton, &GuiButton::exec )));
133 
134  SetBackground( PRESSED, IconRepository::getIcon("empty-pressed.png").getBaseSurface() );
135  SetBackground( HIGHLITED, IconRepository::getIcon("empty-high.png").getBaseSurface() );
136  SetBackground( UNPRESSED, IconRepository::getIcon("empty.png").getBaseSurface() );
137  SetBorderSize(0,0,0);
138  SetDirtyUpdate(true);
139 
140  SetBehaviour( SIGNALONRELEASE );
141 
142  updateIcon();
143 }
144 
145 
147 {
148  SDL_Surface* icn = referenceButton->GetIcon( UNPRESSED );
149  if ( icn ) {
150  smallIcon = PG_Draw::ScaleSurface( icn, smallGuiIconSizeFactor, smallGuiIconSizeFactor );
151  SetIcon( smallIcon, NULL, NULL, true );
152  } else
153  smallIcon = NULL;
154 }
155 
156 
157 
159 {
160  SetPressed(true);
161  Update();
162 }
163 
165 {
166  if ( referenceButton && referenceButton->func )
167  MessagingHub::Instance().statusInformation( referenceButton->func->getName(referenceButton->pos, referenceButton->subject, referenceButton->id));
168 }
169 
170 
172 {
173  PG_Button::eventMouseEnter();
174  showInfoText();
175 }
176 
178 {
179  PG_Button::eventMouseLeave();
180  MessagingHub::Instance().statusInformation("");
181 }
182 
183 
185 {
186 }
187 
188 
189 
191 {
192  int num = 0;
193  for ( Functions::iterator i = functions.begin(); i != functions.end(); ++i ) {
194  if ( (*i)->available(pos, subject, 0 )) {
195  GuiButton* b = host->getButton(num);
196  b->registerFunc( *i, pos, subject, 0 );
197  b->Show();
198  ++num;
199  }
200  }
201 
202  host->disableButtons(num);
203 }
204 
205 /*
206 void GuiIconHandler::eval()
207 {
208  MapCoordinate mc = actmap->getCursor();
209 
210  if ( !mc.valid() )
211  return;
212 
213  if ( mc.x >= actmap->xsize || mc.y >= actmap->ysize )
214  return;
215 
216  ContainerBase* subject = actmap->getField(mc)->getContainer();
217 
218  eval( mc, subject );
219 }
220 */
221 
222 bool GuiIconHandler::checkForKey( const SDL_KeyboardEvent* key, int modifier )
223 {
224 #if 0
225  if ( !actmap->getCursor().valid())
226  return false;
227 
228  ContainerBase* subject = actmap->getField(actmap->getCursor())->getContainer();
229 
230  for ( Functions::iterator i = functions.begin(); i != functions.end(); ++i )
231  if ( (*i)->available(actmap->getCursor(), subject, 0 ))
232  if ( (*i)->checkForKey( key, modifier, 0)) {
233  (*i)->execute(actmap->getCursor(), subject, 0 );
234  return true;
235  }
236 #endif
237  return false;
238 }
239 
240 
242 {
243  functions.push_back ( function );
244 }
245 
246 
248 {
249  for ( Functions::iterator i = functions.begin(); i != functions.end(); ++i )
250  delete *i;
251 
252 }
253 
254 
255 
256 
257 
258 NewGuiHost* NewGuiHost::theGuiHost = NULL;
259 
260 NewGuiHost :: NewGuiHost (MainScreenWidget *parent, MapDisplayPG* mapDisplay, const PG_Rect &r )
261  : DashboardPanel( parent, r, "GuiIcons", false ) , handler(NULL), enterKeyPressed(false), keyPressedButton(-1)
262 {
263  this->mapDisplay = mapDisplay;
264  mapDisplay->mouseButtonOnField.connect( sigc::mem_fun( *this, &NewGuiHost::mapIconProcessing ));
265  updateFieldInfo.connect ( sigc::mem_fun( *this, &NewGuiHost::evalCursor ));
266  theGuiHost = this;
267 
268  cursorMoved.connect( sigc::hide_return( sigc::mem_fun( *this, &NewGuiHost::clearSmallIcons )) );
269 
270 
271  PG_Application::GetApp()->sigKeyDown.connect( sigc::mem_fun( *this, &NewGuiHost::eventKeyDownSignal ));
272  PG_Application::GetApp()->sigKeyUp.connect( sigc::mem_fun( *this, &NewGuiHost::eventKeyUpSignal ));
273  SetTransparency(255);
274 
275  parent->lockOptionsChanged.connect( sigc::mem_fun( *this, &NewGuiHost::lockOptionsChanged ));
276 
277  GameMap::sigMapDeletion.connect( sigc::mem_fun( *this, &NewGuiHost::mapDeleted ));
278 }
279 
280 bool NewGuiHost::eventKeyDownSignal(const PG_MessageObject* o, const SDL_KeyboardEvent* key)
281 {
282  return eventKeyDown(key);
283 }
284 bool NewGuiHost::eventKeyUpSignal(const PG_MessageObject* o, const SDL_KeyboardEvent* key)
285 {
286  return eventKeyUp(key);
287 }
288 
289 
290 void NewGuiHost::lockOptionsChanged( int options )
291 {
293  // EnableReceiver(false, true);
294  Hide();
295  else
296  // EnableReceiver(true, true);
297  Show();
298 }
299 
300 
302  bool locked;
303  public:
304  void Lock() { SetCapture(); locked = true; };
305  void Unlock() { ReleaseCapture(); locked = false; };
306 
307  SmallButtonHolder (PG_Widget *parent, const PG_Rect &rect ) : SpecialInputWidget( parent, rect ), locked(false) {};
308  bool eventMouseMotion (const SDL_MouseMotionEvent *motion) { return true; };
309  bool eventMouseButtonDown (const SDL_MouseButtonEvent *button) { return true; };
310  bool eventMouseButtonUp (const SDL_MouseButtonEvent *button) { Unlock(); return true; };
311 
312  bool ProcessEvent(const SDL_Event * event, bool bModal) { return SpecialInputWidget::ProcessEvent( event, bModal ); };
313  bool ProcessEvent ( const SDL_Event * event )
314  {
315  /*
316  PG_RectList* cl = GetChildList ();
317  for(PG_Widget* i = cl->first(); i != NULL; i = i->next()) {
318  if ( i->ProcessEvent( event, true ))
319  return true;
320  }
321  */
322 
323  bool result = false;
324 
325  if ( locked )
326  ReleaseCapture();
327 
328  if ( SpecialInputWidget::ProcessEvent( event, true ))
329  result = true;
330 
331  if ( locked )
332  SetCapture();
333 
334  if ( !result && event->type == SDL_MOUSEBUTTONUP )
335  Unlock();
336 
337  return result;
338  }
339 
340 };
341 
342 int NewGuiHost::gapSize(int num ) {
343  if ( num > 0 )
344  return (num-1)*smallGuiIconSpace;
345  else
346  return 0;
347 }
348 
349 void NewGuiHost::reflowSmallIcons( const SPoint& pos, int count ) {
350  int maxx = 0;
351  int x = 0;
352  int y = 0;
353  for ( int i = 0; i < count; ++i ) {
354  if ( pos.x + (x+1) * smallGuiIconSizeX + gapSize(x+1) > PG_Application::GetScreenWidth() ) {
355  x = 0;
356  y += 1;
357  }
358  getSmallButton(i)->MoveWidget(x*smallGuiIconSizeX + gapSize(x), y*smallGuiIconSizeY + gapSize(y), false );
359  x++;
360  if ( x > maxx)
361  maxx = x;
362 
363  }
364  smallButtonHolder->MoveWidget( PG_Rect( pos.x, pos.y, maxx * smallGuiIconSizeX + gapSize(maxx), (y+1) * smallGuiIconSizeY + gapSize(y+1) ), false );
365 }
366 
367 
369 
371 
373 {
374  if ( !actmap )
375  return;
376 
378 
379  if ( !mc.valid() )
380  return;
381 
382  if ( mc.x >= actmap->xsize || mc.y >= actmap->ysize )
383  return;
384 
385  ContainerBase* subject = actmap->getField(mc)->getContainer();
386 
387  eval( mc, subject );
388 }
389 
390 void NewGuiHost::mapDeleted( GameMap& map )
391 {
392  pendingCommand = NULL;
393  /*
394  while ( theGuiHost->iconHandlerStack.size() >= 1 )
395  popIconHandler();
396  */
397 }
398 
399 
400 void NewGuiHost::eval( const MapCoordinate& pos, ContainerBase* subject )
401 {
402  if ( handler ) {
403  BulkGraphicUpdates bgu(this);
404  handler->eval( pos, subject );
405  }
406 }
407 
408 
410 {
411  if ( !theGuiHost )
412  return;
413 
414  if ( theGuiHost->handler )
415  theGuiHost->iconHandlerStack.push_back( theGuiHost->handler );
416 
417  theGuiHost->handler = iconHandler;
418  iconHandler->registerHost( theGuiHost );
419  updateFieldInfo();
420 }
421 
423 {
424  if ( theGuiHost )
425  return theGuiHost->handler;
426  else
427  return NULL;
428 }
429 
430 
432 {
433  if ( !theGuiHost )
434  return;
435 
436  theGuiHost->clearSmallIcons();
437 
438  assert( theGuiHost->handler );
439 
440  theGuiHost->handler->registerHost( NULL );
441 
442  theGuiHost->handler = theGuiHost->iconHandlerStack.back();
443  theGuiHost->iconHandlerStack.pop_back();
444  updateFieldInfo();
445 }
446 
447 
449 {
450  while ( i >= buttons.size() ) {
451  int w = (Width() - 4 * guiIconSpace) / guiIconColumnNum;
452  GuiButton* b = new GuiButton ( this, PG_Rect( guiIconSpace + i%3 * (w + guiIconSpace), 10 + guiIconSpace + i/3 * (guiIconSpace + guiIconSizeY), guiIconSizeX, guiIconSizeY));
453  buttons.push_back ( b );
454  b->Hide();
455  if ( b->y - y + b->Height() > Height() )
456  SizeWidget( Width(), b->y - y + b->Height(), false );
457  }
458  return buttons[i];
459 }
460 
461 
463 {
464  for ( int j = i; j < buttons.size(); ++j) {
465  GuiButton* b = getButton(j);
466  b->Hide();
467  b->unregisterFunc();
468  }
469 }
470 
471 
472 
473 bool NewGuiHost::mapIconProcessing( const MapCoordinate& pos, const SPoint& mousePos, bool cursorChanged, int button, int prio )
474 {
475  if ( prio > 1 )
476  return false;
477 
478  if ( button != CGameOptions::Instance()->mouse.fieldmarkbutton )
479  return false;
480 
481 
482 
483  // PG_Point p = mapDisplay->ScreenToClient( mousePos.x, mousePos.y );
484  SPoint p = mousePos;
485 
486  MapField* fld = actmap->getField(pos);
487 
488  bool positionedUnderCursor = false;
489  if ( ( fld->vehicle || fld->building) && fieldvisiblenow(fld) )
490  positionedUnderCursor = true;
491 
492  if ( fld->getaTemp() ) {
493  positionedUnderCursor = true;
494  cursorChanged = false;
495  }
496 
497  if ( positionedUnderCursor ) {
498  p.x -= smallGuiIconSizeX/2;
499  p.y -= smallGuiIconSizeY/2;
500  } else {
501  p.x += 2;
502  p.y += 2;
503  }
504 
505  showSmallIcons( mainScreenWidget, p, cursorChanged );
506  return true;
507 }
508 
509 
511 {
512  assert(smallButtonHolder);
513  while ( i >= smallButtons.size() ) {
515  SmallGuiButton* b = new SmallGuiButton ( smallButtonHolder, r, getButton(i), this);
516  smallButtons.push_back ( b );
517  b->Hide();
518  }
519 
520  return smallButtons[i];
521 }
522 
523 
524 bool NewGuiHost::ProcessEvent (const SDL_Event *event, bool bModal)
525 {
527  return true;
528 
529  if ( DashboardPanel::ProcessEvent( event, bModal ))
530  return true;
531 
532  return false;
533 }
534 
535 
536 
537 bool NewGuiHost::showSmallIcons( PG_Widget* parent, const SPoint& pos, bool cursorChanged )
538 {
539  clearSmallIcons();
540 
541  BulkGraphicUpdates bgu;
542 
543  SmallGuiButton* firstSmallButton = NULL;
544 
545  int count = 0;
546  if ( !cursorChanged || CGameOptions::Instance()->mouse.singleClickAction ) {
547  for ( int j = 0; j < buttons.size(); ++j)
548  if ( !getButton(j)->IsHidden() )
549  ++count;
550 
551  if ( count ) {
552  if ( !smallButtonHolder )
553  smallButtonHolder = new SmallButtonHolder ( NULL, PG_Rect::null );
554 
555 
556  reflowSmallIcons( pos, count );
557 
558  for ( int j = 0; j < buttons.size(); ++j) {
559  GuiButton* b = getButton(j);
560  if ( !b->IsHidden() ) {
561  SmallGuiButton* sgi = getSmallButton( j );
562  sgi->updateIcon();
563  sgi->SetHidden(false);
564  if ( j == 0 && sgi->IsMouseInside() )
565  firstSmallButton = sgi;
566  } else
567  getSmallButton( j )->SetHidden(true);
568  }
569  }
570  }
571 
572  bgu.release();
573  if ( smallButtonHolder && count ) {
574  smallButtonHolder->BringToFront();
575  smallButtonHolder->Show();
577 
578  if ( firstSmallButton ) {
579  firstSmallButton->press();
580  firstSmallButton->showInfoText();
581  }
582  }
583 
584  return true;
585 }
586 
587 
589 {
590  if ( keyPressedButton == i )
591  return false;
592 
593  if ( keyPressedButton >= 0 ) {
594  GuiButton* button = getButton( keyPressedButton );
595  if ( button ) {
596  button->SetPressed(false);
597  button->SetToggle(false);
598  }
599  }
600 
601  if ( i < buttons.size() || i < 0 ) {
602  keyPressedButton = i;
603 
604  if ( keyPressedButton >= 0 ) {
605  GuiButton* button = getButton( keyPressedButton );
606  if ( button ) {
607  button->SetToggle(true);
608  button->SetPressed(true);
609  button->showInfoText();
610  }
611  }
612  return true;
613  }
614  return false;
615 }
616 
617 bool NewGuiHost::eventKeyDown(const SDL_KeyboardEvent* key)
618 {
619  int mod = SDL_GetModState() & ~(KMOD_NUM | KMOD_CAPS | KMOD_MODE | SDLK_LSHIFT | SDLK_RSHIFT);
620  if ( mod )
621  return false;
622 
623  if ( !IsVisible() )
624  return false;
625 
626  if ( key->keysym.sym == SDLK_RETURN ) {
627  if ( !enterKeyPressed ) {
628  mapDisplay->keyboadCursorMovement( false );
629  enterKeyPressed = true;
630  setNewButtonPressed( 0 );
631  }
632  return true;
633  }
634 
635  if ( enterKeyPressed ) {
636  if ( key->keysym.sym == SDLK_RIGHT || key->keysym.sym == SDLK_KP6 )
637  return setNewButtonPressed( keyPressedButton + 1);
638 
639  if ( key->keysym.sym == SDLK_LEFT || key->keysym.sym == SDLK_KP4 )
640  if ( keyPressedButton > 0 )
641  return setNewButtonPressed( keyPressedButton - 1);
642 
643  if ( key->keysym.sym == SDLK_UP || key->keysym.sym == SDLK_KP8 )
644  if ( keyPressedButton >= guiIconColumnNum )
645  return setNewButtonPressed( keyPressedButton - guiIconColumnNum );
646 
647  if ( key->keysym.sym == SDLK_DOWN || key->keysym.sym == SDLK_KP2 )
648  return setNewButtonPressed( keyPressedButton + guiIconColumnNum );
649 
650  if ( key->keysym.sym == SDLK_ESCAPE || key->keysym.sym == SDLK_END ) {
651  enterKeyPressed = false;
652  mapDisplay->keyboadCursorMovement( true );
653 
654  setNewButtonPressed( -1 );
655  return true;
656  }
657 
658  } else {
659  int modifier = SDL_GetModState();
660  for ( int j = 0; j < buttons.size(); ++j)
661  if ( getButton(j)->ready() )
662  if ( getButton(j)->checkForKey( key, modifier ))
663  return true;
664 
665  if ( handler )
666  if ( handler->checkForKey( key, modifier ))
667  return true;
668 
669  }
670 
671  return false;
672 }
673 
674 bool NewGuiHost::eventKeyUp(const SDL_KeyboardEvent* key)
675 {
676  if ( key->keysym.sym == SDLK_RETURN && enterKeyPressed ) {
677  enterKeyPressed = false;
678  mapDisplay->keyboadCursorMovement( true );
679 
680  GuiButton* button = getButton( keyPressedButton );
681  if ( button )
682  button->exec();
683 
684  setNewButtonPressed( -1 );
685  return true;
686  }
687 
688  return false;
689 }
690 
691 
692 #if 0
693 
695 {
696  bool bulk = PG_Application::GetBulkMode();
697 
698  // if ( !bulk )
699  // PG_Application::SetBulkMode(true);
700 
701  bool redraw;
702  PG_Rect redrawRect;
703  if ( smallButtonHolder ) {
704  redraw = true;
705  redrawRect = *smallButtonHolder;
706  } else
707  redraw = false;
708 
709  delete smallButtonHolder;
710  smallButtonHolder = NULL;
711 
712  if ( !bulk ) {
713  // PG_Application::SetBulkMode(false);
714  // mapDisplay->UpdateRect( true );
715  }
716 
717  return true;
718 }
719 
720 #endif
721 
723 {
724  if ( smallButtonHolder && smallButtonHolder->IsVisible() ) {
726  smallButtonHolder->Hide();
727  }
728  return true;
729 }
730 
731 
733 {
734  if ( handler )
735  handler->registerHost( NULL );
736 
737 }
738 
740 {
744  map->cleartemps();
745  repaintMap();
746  }
747 }
virtual bool checkForKey(const SDL_KeyboardEvent *key, int modifier)
virtual void eval(const MapCoordinate &pos, ContainerBase *subject)
checks evaluates the field on which the cursor resides
void disableButtons(int i)
disables all button from i onward
virtual bool checkForKey(const SDL_KeyboardEvent *key, int modifier, int num)
bool eventKeyUp(const SDL_KeyboardEvent *key)
GuiButton * getButton(int i)
void cleartemps(int b=-1, int value=0)
Definition: gamemap.cpp:964
MapCoordinate & getCursor()
Definition: gamemap.cpp:933
int xsize
the size of the map
Definition: gamemap.h:201
map accessing and usage routines used by ASC and the mapeditor
bool ready()
Vehicle * vehicle
Definition: mapfield.h:89
bool valid() const
Definition: typen.h:221
const int smallGuiIconSizeY
Everything that happens on the main screen of ASC.
void registerUserFunction(GuiFunction *function)
registers a user function.
void eventMouseLeave()
int gapSize(int num)
const int guiIconSizeX
bool ProcessEvent(const SDL_Event *event)
bool mapIconProcessing(const MapCoordinate &pos, const SPoint &mousePos, bool cursorChanged, int button, int prio)
static Command * pendingCommand
sigc::signal< void > repaintMap
}@
Definition: spfst.cpp:45
void showInfoText()
ContainerBase * getContainer()
returns a pointer to the ContainerBase of the field or NULL if there is none
Definition: mapfield.cpp:331
a single field of the map
Definition: mapfield.h:26
A Command is an action that the player initiates.
Definition: command.h:114
SmallButtonHolder(PG_Widget *parent, const PG_Rect &rect)
SDL_Surface * getBaseSurface()
Definition: surface.h:116
ASCString getMessage() const
bool eventMouseMotion(const SDL_MouseMotionEvent *motion)
const float smallGuiIconSizeFactor
bool clearSmallIcons()
const int smallGuiIconSpace
static void popIconHandler()
bool fieldvisiblenow(const MapField *pe, Vehicle *veh, int player)
{@
Definition: spfst.cpp:399
virtual bool available(const MapCoordinate &pos, ContainerBase *subject, int num)=0
bool eventKeyDown(const SDL_KeyboardEvent *key)
const int guiIconSizeY
GuiButton(PG_Widget *parent, const PG_Rect &r)
static GuiIconHandler * getIconHandler()
bool checkForKey(const SDL_KeyboardEvent *key, int modifier)
virtual ASCString getName(const MapCoordinate &pos, ContainerBase *subject, int num)=0
Coordinate on the twodimensional map.
Definition: typen.h:202
const int guiIconSpace
static sigc::signal< void, GameMap & > sigMapDeletion
Definition: gamemap.h:501
Uint8 getaTemp()
Definition: mapfield.cpp:52
SmallGuiButton * getSmallButton(int i)
virtual ~GuiIconHandler()
void callFunc(const MapCoordinate &pos, ContainerBase *subject, int num)
bool eventMouseButtonDown(const SDL_MouseButtonEvent *button)
sigc::signal< void > updateFieldInfo
Definition: spfst.cpp:47
void reflowSmallIcons(const SPoint &pos, int count)
NewGuiHost(MainScreenWidget *parent, MapDisplayPG *mapDisplay, const PG_Rect &r)
const int guiIconColumnNum
SDLmm::SPoint SPoint
Definition: surface.h:27
void errorMessage(const ASCString &string)
static CGameOptions * Instance()
returns the only Instance
Definition: gameoptions.cpp:38
int ysize
Definition: gamemap.h:201
sigc::signal< bool, const MapCoordinate &, const SPoint &, bool, int, int > mouseButtonOnField
Signal that is fired when the mouse is pressed on a valid field, after the cursor evaluation has been...
Definition: mapdisplay.h:314
Buttons buttons
void registerFunc(GuiFunction *f, const MapCoordinate &position, ContainerBase *subject, int id)
static Surface & getIcon(const ASCString &name)
bool showSmallIcons(PG_Widget *parent, const SPoint &pos, bool cursorChanged)
Building * building
Definition: mapfield.h:102
ASC_MainScreenWidget * mainScreenWidget
sigc::signal< void > cursorMoved
Definition: spfst.cpp:48
bool setNewButtonPressed(int i)
when operated by keyboard, set a new button as the pressed one
GameMap * actmap
Definition: spfst.cpp:64
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
Definition: containerbase.h:40
bool ProcessEvent(const SDL_Event *event, bool bModal)
const int smallGuiIconSizeX
SmallButtons smallButtons
static SmallButtonHolder * smallButtonHolder
SmallGuiButton(PG_Widget *parent, const PG_Rect &r, GuiButton *guiButton, NewGuiHost *host)
void eventMouseEnter()
void unregisterFunc()
NewGuiHost * host
virtual Surface & getImage(const MapCoordinate &pos, ContainerBase *subject, int num)=0
bool eventMouseButtonUp(const SDL_MouseButtonEvent *button)
virtual void execute(const MapCoordinate &pos, ContainerBase *subject, int num)=0
static void pushIconHandler(GuiIconHandler *iconHandler)
void keyboadCursorMovement(bool enable)
Definition: mapdisplay.h:266
sigc::signal< void, int > lockOptionsChanged
bool ProcessEvent(const SDL_Event *event, bool bModal)
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182
void resetActiveGuiAction(GameMap *map)
MapField * getField(int x, int y)
Definition: gamemap.h:465