mainscreenwidget.h

Go to the documentation of this file.
00001 /*
00002     This file is part of Advanced Strategic Command; http://www.asc-hq.de
00003     Copyright (C) 1994-2010  Martin Bickel  and  Marc Schellenberger
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; see the file COPYING. If not, write to the
00017     Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00018     Boston, MA  02111-1307  USA
00019 */
00020 
00021 
00022 #ifndef mainscreenwidgetH
00023  #define mainscreenwidgetH
00024 
00025 #include "paradialog.h"
00026 #include "util/messaginghub.h"
00027 #include "overviewmappanel.h"
00028 
00029 // class Menu;
00030 class MapDisplayPG;
00031 class OverviewMapPanel;
00032 
00033 class MainScreenWidget : public PG_Widget {
00034     PG_Application& app;
00035     Surface backgroundImage;
00036     SDL_Rect blitRects[4];
00037     
00038     int lastMessageTime;
00039     int lastMouseScrollTime;
00040 
00041     StatusMessageWindowHolder createStatusWindow( const ASCString& msg );
00042     
00043     void buildBackgroundImage( bool messageLine );
00044         
00045     OverviewMapPanel* overviewMapPanel;
00046 
00047     friend class StandardActionLocker;
00048     
00049 protected:
00050     int lockOptions;
00051     
00052 public:
00053     MainScreenWidget( PG_Application& application );
00054 
00055     void displayMessage( const ASCString& message );
00056     
00057     void activateMapLayer( const ASCString& name, bool active );
00058     void toggleMapLayer( const ASCString& name );
00059 
00060     MapDisplayPG* getMapDisplay() { return mapDisplay; };
00061 
00062     OverviewMapPanel* getOverviewMapPanel()
00063     {
00064       return overviewMapPanel;
00065     };
00066 
00071     class StandardActionLocker {
00072          MainScreenWidget* widget;
00073          bool locked;
00074          void operator=( StandardActionLocker& locker ) {};
00075          int options;
00076        public:
00083           StandardActionLocker( MainScreenWidget* mainScreenWidget, int options );
00084           StandardActionLocker( const StandardActionLocker& locker );
00085           void lock();
00086           void unlock();
00087           ~StandardActionLocker();
00088     };
00089     
00090     struct LockOptions {
00091       enum Options{ Menu = 1, MapActions = 2, MapControl = 4 };
00092     }; 
00093     
00094 
00095     SigC::Signal1<void,int> lockOptionsChanged;
00096     
00097     
00098 protected:
00099    virtual void lockStandardActions( int dir, int options = 0 ) {};
00100    
00101    MapDisplayPG* mapDisplay;
00102     // Menu* menu;
00103     PG_Label* messageLine;
00104 
00105     void spawnOverviewMapPanel ( const ASCString& panelName = "OverviewMap");
00106     
00107     void setup( bool messageLine, const PG_Rect& mapView );
00108     
00109     bool idleHandler( PG_MessageObject* msgObj );
00110 
00111     void mouseScrollChecker();
00112 
00113     virtual ASCString getBackgroundImageFilename() = 0;
00114     void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst) ;
00115     ~MainScreenWidget() { };
00116 };
00117 
00118 
00119 extern MainScreenWidget* getMainScreenWidget();
00120 
00121 #endif
00122 

Generated on Mon May 21 01:26:34 2012 for Advanced Strategic Command by  doxygen 1.5.1