Planeshift
|
00001 /* 00002 * psmainwidget.h - Author: Andrew Craig 00003 * 00004 * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 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 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 // pawsmainwidget.h: interface for the pawsMainWidget class. 00020 // 00022 00023 #ifndef PS_MAIN_WIDGET_HEADER 00024 #define PS_MAIN_WIDGET_HEADER 00025 //============================================================================= 00026 // Crystal Space Includes 00027 //============================================================================= 00028 #include <iengine/camera.h> 00029 00030 //============================================================================= 00031 // Project Includes 00032 //============================================================================= 00033 #include "net/clientmsghandler.h" 00034 00035 #include "paws/pawswidget.h" 00036 #include "paws/psmousebinds.h" 00037 #include "paws/pawsmainwidget.h" 00038 00039 #include "../pscelclient.h" 00040 00041 //============================================================================= 00042 // Local Includes 00043 //============================================================================= 00044 00045 00046 00047 class pawsChatWindow; 00048 00049 00050 class psEntityType 00051 { 00052 public: 00053 psEntityType(const char *id,const char *label, int dflt, const char *commandsStr, const char *labelsStr); 00054 00055 csString id; 00056 csString label; 00057 int usedCommand, dflt; 00058 csStringArray labels; 00059 csStringArray commands; 00060 }; 00061 00062 class psEntityTypes 00063 { 00064 public: 00065 psEntityTypes(iObjectRegistry* objReg); 00066 csString BuildDfltBehaviors(); 00067 bool LoadConfigFromFile(); 00068 bool SaveConfigToFile(); 00069 00070 csPDelArray<psEntityType> types; 00071 iObjectRegistry* objReg; 00072 csRef<iVFS> vfs; 00073 }; 00074 00075 00076 00079 class psMainWidget : public pawsMainWidget, public psCmdBase 00080 { 00081 public: 00082 psMainWidget(); 00083 virtual ~psMainWidget(); 00084 00085 bool OnKeyDown(utf32_char keyCode, utf32_char key, int modifiers ); 00086 00087 bool OnMouseDown( int button, int modifiers, int x, int y ); 00088 bool OnMouseUp( int button, int modifiers, int x, int y ); 00089 bool OnDoubleClick( int button, int modifiers, int x, int y ); 00090 00091 void LockPlayer() { locked = true; } 00092 bool IsPlayerLocked() { return locked; } 00093 void UnlockPlayer() { locked = false; } 00094 00100 GEMClientObject* FindMouseOverObject( int mouseX, int mouseY ); 00101 00102 psEntityTypes * GetEntityTypes() { return &entTypes; } 00103 00105 void HandleMessage( MsgEntry* message ); 00106 00108 const char* HandleCommand(const char* /*cmd*/) { return NULL; } 00109 00121 void PrintOnScreen(const char* text, int color, float ymod = 0.50f); 00122 00123 public: 00124 void ClearFadingText(); 00125 00126 void DrawChildren(); 00127 00132 void Draw() {} 00133 bool SetupMain(); 00134 00135 void DeleteChild(pawsWidget* txtBox); 00136 00143 bool GetMesgOption(int mesgType); 00148 void SetMesgOption(int mesgType, bool value); 00153 bool LoadConfigFromFile(); 00158 bool SaveConfigToFile(); 00159 00161 struct mesgOption 00162 { 00163 int type; 00164 bool value; 00165 }; 00166 00170 csHash<mesgOption, int>::GlobalIterator GetMesgOptionsIterator(){ return mesgOptions.GetIterator(); } 00173 private: 00174 00175 pawsChatWindow *chatWindow; 00176 psCelClient* cel; 00177 00179 bool locked; 00180 00181 psEntityTypes entTypes; 00182 00183 pawsWidget* lastWidget; 00184 00187 csRef<iFont> mesgFont; 00188 csRef<iFont> mesgFirstFont; 00189 00190 csArray<pawsWidget*> onscreen; 00191 csHash<mesgOption, int> mesgOptions; 00192 00193 }; 00194 00195 #endif 00196 00197