~eda-qa/dhlib/main

« back to all changes in this revision

Viewing changes to lib/ui/MenuEvent.hx

  • Committer: edA-qa mort-ora-y
  • Date: 2010-02-16 05:36:32 UTC
  • Revision ID: eda-qa@disemia.com-20100216053632-60lt7fndfi3fgblw
first

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* <license>
 
2
 * This file is part of the dis-Emi-A HaXe Library. Copyright (c) edA-qa mort-ora-y
 
3
 * For full copyright and license information please refer to doc/license.txt.
 
4
 * </license> 
 
5
 */
 
6
package ui;
 
7
 
 
8
#if neash
 
9
import neash.events.Event;
 
10
#elseif flash
 
11
import flash.events.Event;
 
12
#end
 
13
 
 
14
/**
 
15
 * A generic event for menu items.
 
16
 *
 
17
 * The constructor allows both the standard type and a dynamic extension.
 
18
 * This extension is simply held by the MenuEvent and available in the
 
19
 * handler.  This allows you to use one "type" with multiple dynamic items
 
20
 * to avoid needing several handlers (as often some menu items call the
 
21
 * same procedure with only slightly different parameters)
 
22
 */
 
23
class MenuEvent extends Event
 
24
{
 
25
        public var ext : Dynamic;       //an extension object
 
26
        
 
27
        public function new( evtStr : String, ?aext : Dynamic )
 
28
        {
 
29
                super( evtStr, true );  //bubbles by default
 
30
                ext = aext;
 
31
        }
 
32
        
 
33
        //HAXE: Bug prevents overriding of clone... so for now we use a custom
 
34
        //solution with the Popup manager also recognizing this
 
35
        public function fixClone( ) : Event
 
36
        {
 
37
                return new MenuEvent( type, ext );
 
38
        }
 
39
}