1////////////////////////////////////////////////////////////////////////////////
2//
3//  ADOBE SYSTEMS INCORPORATED
4//  Copyright 2008 Adobe Systems Incorporated
5//  All Rights Reserved.
6//
7//  NOTICE: Adobe permits you to use, modify, and distribute this file
8//  in accordance with the terms of the license agreement accompanying it.
9//
10////////////////////////////////////////////////////////////////////////////////
11
12package spark.events
13{
14
15import flash.events.Event;
16
17import flashx.textLayout.operations.FlowOperation;
18
19/**
20 *  The TextOperationEvent class represents events that are dispatched
21 *  when text content changes due to user operations
22 *  such as inserting characters, backspacing, pasting,
23 *  or changing text attributes.
24 *
25 *  <p>This event is dispatched by subclasses of the SkinnableTextBase class. This
26 *  includes RichEditableText and classes that use RichEditableText such as ComboBox and
27 *  TextInput, as well as TextArea. Text controls that have no user interaction,
28 *  such as RichText and Label, do not dispatch events of this type.</p>
29 *
30 *  @see spark.components.RichEditableText
31 *  @see spark.components.TextArea
32 *  @see spark.components.ComboBox
33 *  @see spark.components.TextInput
34 *  @see spark.components.supportClasses.SkinnableTextBase
35 *
36 *  @langversion 3.0
37 *  @playerversion Flash 10
38 *  @playerversion AIR 1.5
39 *  @productversion Flex 4
40 */
41public class TextOperationEvent extends Event
42{
43    include "../core/Version.as";
44
45    //--------------------------------------------------------------------------
46    //
47    //  Class constants
48    //
49    //--------------------------------------------------------------------------
50
51    /**
52     *  The <code>TextOperationEvent.CHANGING</code> constant
53     *  defines the value of the <code>type</code> property of the event
54     *  object for a <code>changing</code> event.
55     *
56     *  <p>The properties of the event object have the following values:</p>
57     *  <table class="innertable">
58     *     <tr><th>Property</th><th>Value</th></tr>
59     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
60     *     <tr><td><code>cancelable</code></td><td>true</td></tr>
61     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
62     *       event listener that handles the event. For example, if you use
63     *       <code>myButton.addEventListener()</code> to register an event listener,
64     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
65     *     <tr><td><code>operation</code></td><td>The FlowOperation object
66     *       describing the editing operation being performed
67     *       on the text by the user.</td></tr>
68     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
69     *       it is not always the Object listening for the event.
70     *       Use the <code>currentTarget</code> property to always access the
71     *       Object listening for the event.</td></tr>
72     *  </table>
73     *
74     *  @eventType changing
75     *
76     *  @langversion 3.0
77     *  @playerversion Flash 10
78     *  @playerversion AIR 1.5
79     *  @productversion Flex 4
80     */
81    public static const CHANGING:String = "changing";
82
83    /**
84     *  The <code>TextOperationEvent.CHANGE</code> constant
85     *  defines the value of the <code>type</code> property of the event
86     *  object for a <code>change</code> event.
87     *
88     *  <p>The properties of the event object have the following values:</p>
89     *  <table class="innertable">
90     *     <tr><th>Property</th><th>Value</th></tr>
91     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
92     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
93     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
94     *       event listener that handles the event. For example, if you use
95     *       <code>myButton.addEventListener()</code> to register an event listener,
96     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
97     *     <tr><td><code>operation</code></td><td>The FlowOperation object
98     *       describing the editing operation being performed
99     *       on the text by the user.</td></tr>
100     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
101     *       it is not always the Object listening for the event.
102     *       Use the <code>currentTarget</code> property to always access the
103     *       Object listening for the event.</td></tr>
104     *  </table>
105     *
106     *  @eventType change
107     *
108     *  @langversion 3.0
109     *  @playerversion Flash 10
110     *  @playerversion AIR 1.5
111     *  @productversion Flex 4
112     */
113    public static const CHANGE:String = "change";
114
115    //--------------------------------------------------------------------------
116    //
117    //  Constructor
118    //
119    //--------------------------------------------------------------------------
120
121    /**
122     *  Constructor.
123     *
124     *  @param type The event type; indicates the action that caused the event.
125     *
126     *  @param bubbles Specifies whether the event
127     *  can bubble up the display list hierarchy.
128     *
129     *  @param cancelable Specifies whether the behavior
130     *  associated with the event can be prevented.
131     *
132     *  @param operation The FlowOperation object representing
133     *  the editing operation being performed on the text by the user.
134     *
135     *  @langversion 3.0
136     *  @playerversion Flash 10
137     *  @playerversion AIR 1.5
138     *  @productversion Flex 4
139     */
140    public function TextOperationEvent(type:String, bubbles:Boolean = false,
141                                       cancelable:Boolean = true,
142                                       operation:FlowOperation = null)
143    {
144        super(type, bubbles, cancelable);
145
146        this.operation = operation;
147    }
148
149    //--------------------------------------------------------------------------
150    //
151    //  Properties
152    //
153    //--------------------------------------------------------------------------
154
155    //----------------------------------
156    //  operation
157    //----------------------------------
158
159    /**
160     *  The FlowOperation object representing the editing operation
161     *  being performed on the text by the user.
162     *
163     *  <p>This might be an InsertTextOperation, a DeleteTextOperation,
164     *  a SplitParagraphOperation, a CutOperation, a PasteOperation,
165     *  an UndoOperation, or other subclass of FlowOperation.</p>
166     *
167     *  @see flashx.textLayout.operations.InsertTextOperation
168     *  @see flashx.textLayout.operations.DeleteTextOperation
169     *  @see flashx.textLayout.operations.SplitParagraphOperation
170     *  @see flashx.textLayout.operations.PasteOperation
171     *  @see flashx.textLayout.operations.CutOperation
172     *  @see flashx.textLayout.operations.UndoOperation
173     *
174     *  @langversion 3.0
175     *  @playerversion Flash 10
176     *  @playerversion AIR 1.5
177     *  @productversion Flex 4
178     */
179    public var operation:FlowOperation;
180
181    //--------------------------------------------------------------------------
182    //
183    //  Overridden methods: Event
184    //
185    //--------------------------------------------------------------------------
186
187    /**
188     *  @private
189     */
190    override public function clone():Event
191    {
192        return new TextOperationEvent(type, bubbles, cancelable, operation);
193    }
194}
195
196}
197