Planeshift
psmainwidget.h
Go to the documentation of this file.
1 /*
2  * psmainwidget.h - Author: Andrew Craig
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
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  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 // pawsmainwidget.h: interface for the pawsMainWidget class.
20 //
22 
23 #ifndef PS_MAIN_WIDGET_HEADER
24 #define PS_MAIN_WIDGET_HEADER
25 //=============================================================================
26 // Crystal Space Includes
27 //=============================================================================
28 #include <iengine/camera.h>
29 
30 //=============================================================================
31 // Project Includes
32 //=============================================================================
33 #include "net/clientmsghandler.h"
34 
35 #include "paws/pawswidget.h"
36 #include "paws/psmousebinds.h"
37 #include "paws/pawsmainwidget.h"
38 
39 #include "../pscelclient.h"
40 
41 //=============================================================================
42 // Local Includes
43 //=============================================================================
44 
45 
46 
47 class pawsChatWindow;
48 
49 
51 {
52 public:
53  psEntityType(const char *id,const char *label, int dflt, const char *commandsStr, const char *labelsStr);
54 
55  csString id;
56  csString label;
58  csStringArray labels;
59  csStringArray commands;
60 };
61 
63 {
64 public:
65  psEntityTypes(iObjectRegistry* objReg);
66  csString BuildDfltBehaviors();
67  bool LoadConfigFromFile();
68  bool SaveConfigToFile();
69 
70  csPDelArray<psEntityType> types;
71  iObjectRegistry* objReg;
72  csRef<iVFS> vfs;
73 };
74 
75 
76 
79 class psMainWidget : public pawsMainWidget, public psCmdBase
80 {
81 public:
82  psMainWidget();
83  virtual ~psMainWidget();
84 
85  bool OnKeyDown(utf32_char keyCode, utf32_char key, int modifiers );
86 
87  bool OnMouseDown( int button, int modifiers, int x, int y );
88  bool OnMouseUp( int button, int modifiers, int x, int y );
89  bool OnDoubleClick( int button, int modifiers, int x, int y );
90 
91  void LockPlayer() { locked = true; }
92  bool IsPlayerLocked() { return locked; }
93  void UnlockPlayer() { locked = false; }
94 
100  GEMClientObject* FindMouseOverObject( int mouseX, int mouseY );
101 
102  psEntityTypes * GetEntityTypes() { return &entTypes; }
103 
105  void HandleMessage( MsgEntry* message );
106 
108  const char* HandleCommand(const char* /*cmd*/) { return NULL; }
109 
121  void PrintOnScreen(const char* text, int color, float ymod = 0.50f);
122 
123  public:
124  void ClearFadingText();
125 
126  void DrawChildren();
127 
132  void Draw() {}
133  bool SetupMain();
134 
135  void DeleteChild(pawsWidget* txtBox);
136 
143  bool GetMesgOption(int mesgType);
148  void SetMesgOption(int mesgType, bool value);
153  bool LoadConfigFromFile();
158  bool SaveConfigToFile();
159 
161  struct mesgOption
162  {
163  int type;
164  bool value;
165  };
166 
170  csHash<mesgOption, int>::GlobalIterator GetMesgOptionsIterator(){ return mesgOptions.GetIterator(); }
173 private:
174 
175  pawsChatWindow *chatWindow;
176  psCelClient* cel;
177 
179  bool locked;
180 
181  psEntityTypes entTypes;
182 
183  pawsWidget* lastWidget;
184 
187  csRef<iFont> mesgFont;
188  csRef<iFont> mesgFirstFont;
189 
190  csArray<pawsWidget*> onscreen;
191  csHash<mesgOption, int> mesgOptions;
192 
193 };
194 
195 #endif
196 
197 
csStringArray labels
Definition: psmainwidget.h:58
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
csRef< iVFS > vfs
Definition: psmainwidget.h:72
Main Chat window for PlaneShift.
Definition: chatwindow.h:133
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
Used to store an option about on screen options.
Definition: psmainwidget.h:161
Client version of the Cel Manager Requests world loading.
Definition: pscelclient.h:108
csStringArray commands
Definition: psmainwidget.h:59
csString id
Definition: psmainwidget.h:55
iObjectRegistry * objReg
Definition: psmainwidget.h:71
void LockPlayer()
Definition: psmainwidget.h:91
csHash< mesgOption, int >::GlobalIterator GetMesgOptionsIterator()
Returns an iterator to iterate the options about on-screen messages.
Definition: psmainwidget.h:170
int type
The type of message.
Definition: psmainwidget.h:163
The main or desktop widget.
An object that the client knows about.
Definition: pscelclient.h:373
bool value
If the message is active or not.
Definition: psmainwidget.h:164
csString label
Definition: psmainwidget.h:56
psEntityType(const char *id, const char *label, int dflt, const char *commandsStr, const char *labelsStr)
csPDelArray< psEntityType > types
Definition: psmainwidget.h:70
void UnlockPlayer()
Definition: psmainwidget.h:93
void Draw()
Draw method.
Definition: psmainwidget.h:132
bool IsPlayerLocked()
Definition: psmainwidget.h:92
const char * HandleCommand(const char *)
Handles commands (unused for now)
Definition: psmainwidget.h:108
psEntityTypes * GetEntityTypes()
Definition: psmainwidget.h:102
The main or desktop widget.
Definition: psmainwidget.h:79