Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /event_manager.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (hide annotations) (download)
Thu Apr 5 11:53:35 2007 UTC (16 years, 11 months ago) by bluedwarf
File size: 1595 byte(s)
Added Copyright notice.

1 bluedwarf 10 #
2     # Edmaru: A scalable editor implemented by Ruby.
3     # Copyright (C) 2007 Takashi Nakamoto
4     #
5     # This program is free software; you can redistribute it and/or modify
6     # it under the terms of the GNU General Public License version 2 as
7     # published by the Free Software Foundation.
8     #
9     # This program is distributed in the hope that it will be useful, but
10     # WITHOUT ANY WARRANTY; without even the implied warranty of
11     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12     # General Public License for more details.
13     #
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., 51 Franklin Street, Fifth Floor, Boston, MA
17     # 02110-1301 USA.
18     #
19 bluedwarf 2
20     require "event_handler/event_handler.rb"
21    
22     module Edmaru
23    
24     #The controller to manage event handlers.
25     class EventManager
26    
27     #Create an event manager.
28     #
29     #=== Return
30     #An initialized manager.
31     def initialize
32     @current_handler = nil
33     end
34    
35     #Set the handler whose name is _handler_name_ as the current handler
36     #
37     #=== Argument
38     #_handler_ :: An instance of Edmaru::EventHandler to be added.
39     def set_current_handler(handler)
40     @current_handler = handler
41     end
42    
43     #Make the current handler to handle the specified event.
44     #
45     #=== Argument
46     #_event_name_ :: A String instance representing the event name.
47     def handle(event_name)
48     if @current_handler != nil
49     @current_handler.handle(event_name)
50     else
51     raise "Event handler has not been registered yet!"
52     end
53     end
54     end
55     end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26