source: trunk/game/scripts/common/eventlistenerbase.py @ 348

Revision 315, 2.2 KB checked in by eliedebrauwer, 10 years ago (diff)

Ticket #2: Patch by eliedebrauwer. Performed some cleanup on scripts/common and scripts/objects. comment[s:trac, t:66]

  • Property svn:eol-style set to native
Line 
1#!/usr/bin/python
2
3#   This file is part of PARPG.
4
5#   PARPG is free software: you can redistribute it and/or modify
6#   it under the terms of the GNU General Public License as published by
7#   the Free Software Foundation, either version 3 of the License, or
8#   (at your option) any later version.
9
10#   PARPG 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
15#   You should have received a copy of the GNU General Public License
16#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
17
18import fife
19
20class EventListenerBase(fife.IKeyListener, fife.ICommandListener, fife.IMouseListener, fife.ConsoleExecuter):
21    def __init__(self, engine, reg_keys=False, reg_cmd=False, reg_mouse=False, reg_console=False, reg_widget=False):
22        """Initialise the instance"""
23        self.event_manager = engine.getEventManager()
24
25        fife.IKeyListener.__init__(self)
26        if reg_keys:
27            self.event_manager.addKeyListener(self)
28        fife.ICommandListener.__init__(self)
29        if reg_cmd:
30            self.event_manager.addCommandListener(self)
31        fife.IMouseListener.__init__(self)
32        if reg_mouse:
33            self.event_manager.addMouseListener(self)
34        fife.ConsoleExecuter.__init__(self)
35        if reg_console:
36            engine.getGuiManager().getConsole().setConsoleExecuter(self)
37
38    def mousePressed(self, evt):
39        pass
40
41    def mouseReleased(self, evt):
42        pass   
43
44    def mouseEntered(self, evt):
45        pass
46
47    def mouseExited(self, evt):
48        pass
49
50    def mouseClicked(self, evt):
51        pass
52
53    def mouseWheelMovedUp(self, evt):
54        pass   
55
56    def mouseWheelMovedDown(self, evt):
57        pass
58
59    def mouseMoved(self, evt):
60        pass
61
62    def mouseDragged(self, evt):
63        pass
64
65    def keyPressed(self, evt):
66        pass
67
68    def keyReleased(self, evt):
69        pass
70
71    def onCommand(self, command):
72        pass
73
74    def onToolsClick(self):
75        print "No tools set up yet"
76
77    def onConsoleCommand(self, command):
78        pass
79
80    def onWidgetAction(self, evt):
81        pass
82
Note: See TracBrowser for help on using the repository browser.