00001 /* 00002 This file is part of Advanced Strategic Command; http://www.asc-hq.de 00003 Copyright (C) 1994-1999 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 "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 00067 class StandardActionLocker { 00068 MainScreenWidget* widget; 00069 bool locked; 00070 void operator=( StandardActionLocker& locker ) {}; 00071 int options; 00072 public: 00073 StandardActionLocker( MainScreenWidget* mainScreenWidget, int options ); 00074 StandardActionLocker( const StandardActionLocker& locker ); 00075 void lock(); 00076 void unlock(); 00077 ~StandardActionLocker(); 00078 }; 00079 00080 struct LockOptions { 00081 enum Options{ Menu = 1, MapActions = 2, MapControl = 4 }; 00082 }; 00083 00084 00085 SigC::Signal1<void,int> lockOptionsChanged; 00086 00087 00088 protected: 00089 virtual void lockStandardActions( int dir, int options = 0 ) {}; 00090 00091 MapDisplayPG* mapDisplay; 00092 // Menu* menu; 00093 PG_Label* messageLine; 00094 00095 void spawnOverviewMapPanel ( const ASCString& panelName = "OverviewMap"); 00096 00097 void setup( bool messageLine, const PG_Rect& mapView ); 00098 00099 bool idleHandler( PG_MessageObject* msgObj ); 00100 00101 void mouseScrollChecker(); 00102 00103 virtual ASCString getBackgroundImageFilename() = 0; 00104 void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst) ; 00105 ~MainScreenWidget() { }; 00106 }; 00107 00108 00109 extern MainScreenWidget* getMainScreenWidget(); 00110 00111 #endif 00112
1.4.2