Planeshift
pawsbookreadingwindow.h
Go to the documentation of this file.
1 /*
2  * pawsbookreadingwindow.h - Author: Daniel Fryer, based on work by 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 
20 #ifndef PAWS_BOOK_READING_WINDOW_HEADER
21 #define PAWS_BOOK_READING_WINDOW_HEADER
22 
23 #include "paws/pawswidget.h"
24 
25 class pawsTextBox;
27 
32 {
33 public:
35  virtual ~pawsBookReadingWindow();
36 
37  bool PostSetup();
38 
39  void HandleMessage(MsgEntry* message);
40 
48  void TurnPage(int count);
49 
57  void SetPage(int page);
58 
59  virtual bool OnMouseDown(int button, int modifiers, int x, int y);
60  virtual bool OnKeyDown(utf32_char keyCode, utf32_char key, int modifiers);
61  virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
62 
63 private:
64  void UpdatePageNumbers(bool mode);
65  pawsTextBox* name;
66  pawsTextBox* pageNum;
67  pawsTextBox* pageNumRight;
68  pawsMultiPageTextBox* description;
69  pawsMultiPageTextBox* descriptionRight;
70  pawsMultiPageTextBox* descriptionCraft;
71  pawsMultiPageTextBox* descriptionCraftRight;
72  pawsWidget* writeButton;
73  pawsWidget* saveButton;
74  pawsWidget* nextButton;
75  pawsWidget* prevButton;
76  bool shouldWrite;
77  int slotID;
78  int containerID;
79  bool usingCraft;
80  csString filenameSafe(const csString &original);
81  bool isBadChar(char c);
82 
84  csRef<iPawsImage> bookBgImage;
85  virtual void Draw();
86 
87  int numPages;
88 
89 };
90 
92 
93 
94 #endif
95 
96 
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
void SetPage(int page)
Turn to a given page.
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
A window that allows to read a book, including text, pagination and images.
virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
virtual bool OnMouseDown(int button, int modifiers, int x, int y)
Manage mouse down event to test for and apply window changes.
bool PostSetup()
This is called after the widget and all of it&#39;s children have been created.
virtual ~pawsBookReadingWindow()
void HandleMessage(MsgEntry *message)
virtual bool OnKeyDown(utf32_char keyCode, utf32_char key, int modifiers)
Process keydown messages.
void TurnPage(int count)
Turn a number of pages.
A basic text box widget.
Definition: pawstextbox.h:42
CREATE_PAWS_FACTORY(pawsBookReadingWindow)