Planeshift
pawspetitionwindow.h
Go to the documentation of this file.
1 /*
2  * pawspetitionwindow.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_HEADER
21 #define PAWS_PETITION_WINDOW_HEADER
22 
23 #include "paws/pawswidget.h"
24 #include "paws/pawslistbox.h"
25 #include "paws/pawsbutton.h"
27 #include "gui/pawscontrolwindow.h"
28 
30 enum {
31  PCOL_GM = 0,
35 };
36 
40 #define MAX_PETITION_LENGTH (65)
41 
42 
55 {
56 public:
59 
61  virtual ~pawsPetitionWindow();
62 
63  virtual void Show();
64 
66  void HandleMessage( MsgEntry* message );
67 
69  const char* HandleCommand(const char* cmd);
70 
72  bool PostSetup();
73 
75  bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget* reporter);
76 
77  void OnListAction( pawsListBox* selected, int status );
78 
79  void Close();
83  void OnStringEntered(const char *name, int param,const char *value);
84 
85 protected:
86 
88  void QueryServer();
89 
91  void SetText(size_t rowNum, int colNum, const char* fmt, ...);
92 
94  void AddPetitions(csArray<psPetitionInfo> &petitions);
95 
98 
101 
104 
106  int petCount;
107 
111 
114 
117 
119 
120 };
121 
125 
126 #endif
This is a window that is controlled by a button on the control bar.
virtual void Show()
When the window is opened let the controller window know about it.
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
bool hasPetInterest
this is set to true the first time a player looks at this petition window this allows for most player...
pawsPetitionWindow()
Constructor.
int currentRow
Holds the current row number (for cancellation)
bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget *reporter)
Handle button clicks.
void QueryServer()
Queries the server for a list of petitions.
csString name
The name of this widget.
Definition: pawswidget.h:217
void AddPetitions(csArray< psPetitionInfo > &petitions)
Function to add the petitions to the listbox given a csArray;.
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
void Close()
Simply calls Hide() unless overidden.
Messages sent to user with petition information.
Definition: messages.h:1003
bool updateSelectedPetition
used to know if we have to update the selected petition after deleting one, or saving one ...
int petCount
to count the number of actual petitions in the list
Contains data for one petition.
Definition: messages.h:972
void OnListAction(pawsListBox *selected, int status)
Called whenever an item in a child list box is selected.
psPetitionInfo selectedPet
keep track of the selected petition so that we can select it after receiving a new petition list ...
void OnStringEntered(const char *name, int param, const char *value)
Handle the prompt window for entering a petition.
const char * HandleCommand(const char *cmd)
Handles commands.
A simple list box widget.
Definition: pawslistbox.h:202
pawsMultilineEditTextBox * petText
Displays text of petition.
pawsListBox * petitionList
List widget of petitions for easy access.
void HandleMessage(MsgEntry *message)
Handles petition server messages.
bool PostSetup()
Setup the widget with command/message handling capabilities.
Window contains a list of the user&#39;s petitions.
This interface defines the callback used by pawsStringPromptWindow to notify another window of a supp...
psPetitionMessage petitionMessage
Holds the most recent petition message from the server.
virtual ~pawsPetitionWindow()
Virtual destructor.
void SetText(size_t rowNum, int colNum, const char *fmt,...)
Quicker way to set text for each column in the listbox:
CREATE_PAWS_FACTORY(pawsPetitionWindow)
The pawsPetitionWindow factory.