Planeshift

pawsguildwindow.h

Go to the documentation of this file.
00001 /*
00002  * pawsguildwindow.h
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 
00020 #ifndef PAWS_GUILD_WINDOW_HEADER
00021 #define PAWS_GUILD_WINDOW_HEADER
00022 
00023 #include "paws/pawswidget.h"
00024 #include "paws/pawsnumberpromptwindow.h"
00025 #include "paws/pawsstringpromptwindow.h"
00026 #include "paws/pawscombopromptwindow.h"
00027 #include "gui/pawscontrolwindow.h"
00028 #include "gui/chatwindow.h"
00029 
00030 class pawsButton;
00031 class pawsListBox;
00032 class pawsCheckBox;
00033 class pawsComboBox;
00034 class pawsEditTextBox;
00035 
00036 typedef struct
00037 {
00038     int char_id;
00039     csString name, public_notes, private_notes;
00040     int points, level;
00041 } guildMemberInfo;
00042 
00043 class pawsGuildWindow : public pawsControlledWindow, public psClientNetSubscriber,public iOnNumberEnteredAction,public iOnStringEnteredAction,public iOnItemChosenAction
00044 {
00045 public:
00046 
00047     pawsGuildWindow();
00048     virtual ~pawsGuildWindow();
00049 
00050     virtual bool PostSetup();
00052     virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
00053     virtual bool OnButtonReleased( int mouseButton, int keyModifier, pawsWidget* widget );
00054     virtual void Show();
00055     virtual void Hide();
00056 
00057     void HandleMessage( MsgEntry* me );
00058 
00059     bool IsCreatingGuild() { return creatingGuild;}
00060     void SetCreatingGuild(bool v) { creatingGuild = v;}
00061 
00062     size_t GetLevel( const char* levelName );
00063 
00065     void OnStringEntered(const char *name,int param,const char *value);
00066     void OnNumberEntered(const char *name,int param,int value);
00067     void OnItemChosen(const char *name,int param,int itemNum, const csString & itemText);
00068 
00069 private:
00070 
00072     bool creatingGuild;
00073 
00077     void SetupLevelNameButtons();
00078 
00080     void Deactivate();
00081 
00082     void HandleGuildData( csString& openString );
00083     void HandleLevelData( csString& openString );
00084     void HandleMemberData( csString& openString );
00085     void HandleAllianceData( csString& openString );
00086 
00087     guildMemberInfo * FindSelectedMemberInfo();
00088     guildMemberInfo * FindMemberInfo(const csString & name);
00089     guildMemberInfo * FindMemberInfo(int char_id);
00090     int FindMemberInListBox(const csString & name);
00091 
00093 //    void SetMemberTextCell(int char_id, int colNum, const csString & text);
00094 
00095     void ExtractLevelInfo(csRef<iDocumentNode> levelNode);
00096     void HideLeaderCheckboxes();
00097 
00099     void OpenGuildLeaveConfirm();
00100 
00106     void SetAllianceWidgetVisibility(int mode);
00107 
00108     // Tab controls
00109     pawsWidget *permissionsPanel,*membersPanel,*alliancesPanel,*settingsPanel,*currentPanel;
00110     pawsButton *permissionsTab,*membersTab,*alliancesTab,*settingsTab,*currentTab;
00111 
00112     pawsTextBox     *guildName;
00113     pawsTextBox     *allianceName;
00114     pawsCheckBox    *guildSecret;
00115     pawsTextBox     *guildWebPage;
00116     pawsListBox     *levelList;
00117     pawsListBox     *memberList;
00118     pawsCheckBox    *onlineOnly;
00119     pawsCheckBox    *guildNotifications;
00120     pawsCheckBox    *allianceNotifications;
00121     pawsTextBox     *memberCount;
00122     pawsMultilineEditTextBox *motdEdit;
00123     pawsListBox     *allianceMemberList;
00124 
00125     csRef<iDocumentSystem> xml;
00126 
00127     csArray<guildMemberInfo> members;
00128 
00129     int char_id;            
00130     int playerLevel;        
00131 
00132     int max_guild_points;   
00133 
00137     csArray<csString> levels;
00138 
00139     pawsChatWindow* chatWindow;
00140 };
00141 
00142 //--------------------------------------------------------------------------
00143 CREATE_PAWS_FACTORY( pawsGuildWindow );
00144 
00145 #endif