Planeshift
pawspetitiongmwindow.h
Go to the documentation of this file.
1 /*
2  * pawspetitiongmwindow.h - Author: Alexander Wiseman
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 
20 #ifndef PAWS_PETITION_WINDOW_GM_HEADER
21 #define PAWS_PETITION_WINDOW_GM_HEADER
22 
23 #include "paws/pawswidget.h"
24 #include "paws/pawslistbox.h"
25 #include "paws/pawsbutton.h"
27 
29 enum {
37 };
38 
42 #define MAX_GMPETITION_LENGTH (65)
43 
56 {
57 public:
60 
62  virtual ~pawsPetitionGMWindow();
63 
65  void Show();
66 
68  void HandleMessage( MsgEntry* message );
69 
71  const char* HandleCommand(const char* cmd);
72 
74  bool PostSetup();
75 
77  bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget* reporter);
78 
79  void OnListAction( pawsListBox* selected, int status );
80 
82  void OnStringEntered(const char *name,int param,const char *value);
83 
84 protected:
85 
87  void QueryServer();
88 
90  void SetText(size_t rowNum, int colNum, const char* fmt, ...);
91 
93  void AddPetitions(csArray<psPetitionInfo> &petitions);
94 
96  void CloseCurrPetition(const char * desc);
97 
98 
101 
104 
107 
109  int petCount;
110 
114 
117 
120 };
121 
125 
126 #endif
Window contains a manageable list of petitions.
psPetitionMessage petitionMessage
Holds the most recent petition message from the server.
int currentRow
Holds the current row number (for cancellation)
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
void QueryServer()
Queries the server for a list of petitions.
pawsMessageTextBox * petText
Displays text of petition.
void Show()
handles the request of petitions and checks if the user is allowed to use this window ...
const char * HandleCommand(const char *cmd)
Handles commands.
bool hasPetInterest
this is set to true the first time a player looks at this petition window this allows for most player...
psPetitionInfo selectedPet
keep track of the selected petition so that we can select it after receiving a new petition list ...
csString name
The name of this widget.
Definition: pawswidget.h:217
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
void OnListAction(pawsListBox *selected, int status)
Called whenever an item in a child list box is selected.
Messages sent to user with petition information.
Definition: messages.h:1003
Contains data for one petition.
Definition: messages.h:972
void CloseCurrPetition(const char *desc)
Send network message to close a petition with explanation.
pawsPetitionGMWindow()
Constructor.
A simple list box widget.
Definition: pawslistbox.h:202
void OnStringEntered(const char *name, int param, const char *value)
Handle popup question window callback.
void AddPetitions(csArray< psPetitionInfo > &petitions)
Function to add the petitions to the listbox given a csArray;.
This is a special type of text box that is used for messages.
Definition: pawstextbox.h:285
This interface defines the callback used by pawsStringPromptWindow to notify another window of a supp...
bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget *reporter)
Handle button clicks.
int petCount
count the number of actual petitions
virtual ~pawsPetitionGMWindow()
Virtual destructor.
void SetText(size_t rowNum, int colNum, const char *fmt,...)
Quicker way to set text for each column in the listbox:
void HandleMessage(MsgEntry *message)
Handles petition server messages.
bool PostSetup()
Setup the widget with command/message handling capabilities.
pawsListBox * petitionList
List widget of petitions for easy access.
CREATE_PAWS_FACTORY(pawsPetitionGMWindow)
The pawsPetitionGMWindow factory.