1 /*
2  * Copyright (C) 2002 - David W. Durham
3  *
4  * This file is part of ReZound, an audio editing application.
5  *
6  * ReZound is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published
8  * by the Free Software Foundation; either version 2 of the License,
9  * or (at your option) any later version.
10  *
11  * ReZound is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
19  */
20 
21 #ifndef __CActionMenuCommand_H__
22 #define __CActionMenuCommand_H__
23 
24 #include "../../config/common.h"
25 #include "fox_compat.h"
26 
27 /*
28  * This class is a normal FXMenuCommand except that the window it's
29  * on doesn't need to setup an event handler for it.  The event
30  * is always performing the action (given by the first parameter
31  * to the constructor) on the active sound window
32  *
33  * So it can be used to conventiently add many buttons to a toolbar
34  * and only specify the AActionFactorys on construction, and that's
35  * it
36  *
37  */
38 
39 #include <string>
40 
41 class AActionFactory;
42 
43 class CActionMenuCommand : public FXMenuCommand
44 {
45 	FXDECLARE(CActionMenuCommand)
46 public:
47 	CActionMenuCommand(AActionFactory *_actionFactory,FXComposite* p, FXIcon* ic, FXuint opts=0);
48 	CActionMenuCommand(FXComposite *p,const CActionMenuCommand &src);
49 
50 	virtual ~CActionMenuCommand();
51 
52 	const string getUntranslatedText() const;
53 
54 	long onMouseClick(FXObject *sender,FXSelector sel,void *ptr);
55 	long onKeyClick(FXObject *sender,FXSelector sel,void *ptr);
56 
57 	long onCommand(FXObject *sender,FXSelector sel,void *ptr);
58 
59 	long onQueryTip(FXObject* sender,FXSelector sel,void *ptr);
60 
61 	enum
62 	{
63 		ID_HOTKEY=FXMenuCommand::ID_LAST,
64 		ID_LAST
65 	};
66 
67 	AActionFactory *getActionFactory() { return actionFactory; }
68 
69 protected:
70 	CActionMenuCommand() : actionFactory(NULL) {}
71 
72 private:
73 	AActionFactory * const actionFactory;
74 	FXString tip;
75 
76 	FXEvent prevEvent;
77 
78 };
79 
80 #endif
81