Planeshift
pstoggle.h
Go to the documentation of this file.
1 /*
2  * pstoggle.h
3  *
4  * Copyright (C) 2001-2010 Atomic Blue (info@planeshift.it, http://www.planeshift.it)
5  *
6  * Credits : Saul Leite <leite@engineer.com>
7  * Mathias 'AgY' Voeroes <agy@operswithoutlife.net>
8  * and all past and present planeshift coders
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation (version 2 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 
24 
25 #ifndef PSTOGGLE_H_
26 #define PSTOGGLE_H_
27 
38 class psToggle
39 {
40  public:
44  psToggle();
48  ~psToggle();
49 
55  void SetCallback(void (*object), void (*function) (void *));
59  void RemoveCallback();
64  void SetToggle(bool newstate);
69  bool GetToggle();
73  void Activate();
77  void Deactivate();
78 
79  private:
80  bool state;
81  void (*callbackobject);
82  void (*callbackfunction) (void *);
83  bool hasCallback;
84 
88  void Callback();
89 };
90 
93 #endif /*PSTOGGLE_H_*/
void SetCallback(void(*object), void(*function)(void *))
Sets a Callback to a object function.
bool GetToggle()
Get Toggle returns state.
void Deactivate()
Set Toggle to false.
void RemoveCallback()
Remove the callback.
Simple Toggle with callback functionality.
Definition: pstoggle.h:38
void SetToggle(bool newstate)
Set Toggle.
psToggle()
Constructor - default state is true.
void Activate()
Set Toggle to true.
~psToggle()
Destructor.