summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/toggleaction.h
blob: 5c62909d3751396d4036ec370db8635669c27d31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/***************************************************************************
                          toggleaction.h  -  description
                             -------------------
    begin                : Son Feb 10 2002
    copyright            : (C) 2002 by Mark Hollomon
    email                : mhh@mindspring.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KSTARS_TOGGLEACTION_H
#define KSTARS_TOGGLEACTION_H

/**@class ToggleAction
	*Subclass of Kaction that allows for the action to have a boolean state (on/off)
	*The class stores the current state, and changes the Action's iconset to reflect
	*the state.
	*@author Mark Hollomon
	*@version 1.0
	*/

#include <tqiconset.h>
#include <tdeaction.h>

class ToggleAction : public TDEAction {
	Q_OBJECT
  
		
	public:
		/**Constructor. */
		ToggleAction(const TQString& ontext, const TQIconSet& onpix, const TQString& offtext, const TQIconSet& offpix, int accel, const TQObject* receiver, const char* slot, TQObject* parent = 0, const char* name = 0 ) ;
		/**Constructor. Same as above, but without icons. */
		ToggleAction(const TQString& ontext, const TQString& offtext, int accel, const TQObject* receiver, const char* slot, TQObject* parent = 0, const char* name = 0 ) ;

		/**Sets the ToolTip text for the "on" state. 
			*@p tip the tooltip string
			*/
		void setOnToolTip(TQString tip);

		/**Sets the ToolTip text for the "off" state. 
			*@p tip the tooltip string
			*/
		void setOffToolTip(TQString tip);

	public slots:
		/**Put the Action in the "off" state.  Update the icon and tooltip. */
		void turnOff();
		/**Put the Action in the "on" state.  Update the icon and tooltip. */
		void turnOn();

	private:
		TQIconSet officon;
		TQIconSet onicon;
		TQString offcap;
		TQString oncap;
		TQString onTip;
		TQString offTip;
		bool state;
};


#endif