Planeshift
pawsyesnobox.h
Go to the documentation of this file.
1 /*
2  * pawsyesnobox.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 
20 #ifndef PAWS_YESNO_BOX_HEADER
21 #define PAWS_YESNO_BOX_HEADER
22 
23 #include "pawswidget.h"
25 
30 // GUI BUTTONS
33 #define CONFIRM_YES -10
34 #define CONFIRM_NO -20
35 
37 typedef void (*YesNoResponseFunc)(bool, void*);
38 
41 class pawsYesNoBox : public pawsWidget
42 {
43 public:
44 
45  pawsYesNoBox();
46  pawsYesNoBox(const pawsYesNoBox &origin);
47  virtual ~pawsYesNoBox();
48 
49  bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget* widget);
50  void SetNotify(pawsWidget* widget);
51 
52  bool PostSetup();
53  void SetText(const char* text);
54 
55  void SetID(int yes = CONFIRM_YES, int no = CONFIRM_NO);
56  void Hide();
57  void SetCallBack(YesNoResponseFunc handler , void* owner, const char* text);
58 
61  static pawsYesNoBox* Create(pawsWidget* notify, const csString &text,
62  int yesID = CONFIRM_YES, int noID = CONFIRM_NO);
63 private:
64  YesNoResponseFunc handler;
65  void* owner;
66 
68  pawsWidget* notify;
69 
70  pawsWidget* yesButton;
71  pawsWidget* noButton;
72  bool useCustomIDs;
73 };
74 
76 
79 #endif
80 
81 
void SetText(const char *text)
void SetNotify(pawsWidget *widget)
bool PostSetup()
This is called after the widget and all of it's children have been created.
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
void SetCallBack(YesNoResponseFunc handler, void *owner, const char *text)
#define CONFIRM_YES
Definition: pawsyesnobox.h:33
#define CONFIRM_NO
Definition: pawsyesnobox.h:34
void Hide()
Makes widget invisible and removes focus if widget has current focus.
bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is released.
CREATE_PAWS_FACTORY(pawsYesNoBox)
static pawsYesNoBox * Create(pawsWidget *notify, const csString &text, int yesID=CONFIRM_YES, int noID=CONFIRM_NO)
Static function that creates and sets up pawsYesNoBox:
This is a yes/no box used to do confirms.
Definition: pawsyesnobox.h:41
virtual ~pawsYesNoBox()
void SetID(int yes=CONFIRM_YES, int no=CONFIRM_NO)
void(* YesNoResponseFunc)(bool, void *)
Definition: pawsyesnobox.h:37