Advanced Strategic Command
mainscreenwidget.h
Go to the documentation of this file.
1 /*
2  This file is part of Advanced Strategic Command; http://www.asc-hq.de
3  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; see the file COPYING. If not, write to the
17  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  Boston, MA 02111-1307 USA
19 */
20 
21 
22 #ifndef mainscreenwidgetH
23  #define mainscreenwidgetH
24 
25 #include "paradialog.h"
26 #include "util/messaginghub.h"
27 #include "overviewmappanel.h"
28 
29 // class Menu;
30 class MapDisplayPG;
31 class OverviewMapPanel;
32 
33 class MainScreenWidget : public PG_Widget {
34  PG_Application& app;
35  Surface backgroundImage;
36  SDL_Rect blitRects[4];
37 
38  int lastMessageTime;
39  int lastMouseScrollTime;
40 
41  StatusMessageWindowHolder createStatusWindow( const ASCString& msg );
42 
43  void buildBackgroundImage( bool messageLine );
44 
45  OverviewMapPanel* overviewMapPanel;
46 
47  friend class StandardActionLocker;
48 
49 protected:
51 
52 public:
53  MainScreenWidget( PG_Application& application );
54 
55  void displayMessage( const ASCString& message );
56 
57  void activateMapLayer( const ASCString& name, bool active );
58  void toggleMapLayer( const ASCString& name );
59 
61 
63  {
64  return overviewMapPanel;
65  };
66 
72  MainScreenWidget* widget;
73  bool locked;
74  void operator=( StandardActionLocker& locker ) {};
75  int options;
76  public:
85  void lock();
86  void unlock();
88  };
89 
90  struct LockOptions {
91  enum Options{ Menu = 1, MapActions = 2, MapControl = 4 };
92  };
93 
94 
95  sigc::signal<void,int> lockOptionsChanged;
96 
97 
98 protected:
99  virtual void lockStandardActions( int dir, int options = 0 ) {};
100 
102  // Menu* menu;
103  PG_Label* messageLine;
104 
105  void spawnOverviewMapPanel ( const ASCString& panelName = "OverviewMap");
106 
107  void setup( bool messageLine, const PG_Rect& mapView );
108 
109  bool idleHandler();
110 
111  void mouseScrollChecker();
112 
114  void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst) ;
116 };
117 
118 
120 
121 #endif
122 
MainScreenWidget * getMainScreenWidget()
void eventBlit(SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst)
virtual void lockStandardActions(int dir, int options=0)
Instanciating this class will disable the Controls for interacting with the map or the main menu...
void toggleMapLayer(const ASCString &name)
void activateMapLayer(const ASCString &name, bool active)
A class that hols a MessageWindow. This class ensures that the window is removed if the last copy of ...
Definition: messaginghub.h:34
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
MainScreenWidget(PG_Application &application)
PG_Label * messageLine
MapDisplayPG * mapDisplay
virtual ASCString getBackgroundImageFilename()=0
Dialog classes based on the Paragui library.
MapDisplayPG * getMapDisplay()
void displayMessage(const ASCString &message)
ASC_MainScreenWidget * mainScreenWidget
OverviewMapPanel * getOverviewMapPanel()
void spawnOverviewMapPanel(const ASCString &panelName="OverviewMap")
void setup(bool messageLine, const PG_Rect &mapView)
sigc::signal< void, int > lockOptionsChanged
StandardActionLocker(MainScreenWidget *mainScreenWidget, int options)
Disables certain controls on the game's screen.