| 1 |
/******************************************************************************* |
|---|
| 2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
|---|
| 3 |
* All rights reserved. This program and the accompanying materials |
|---|
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
|---|
| 5 |
* which accompanies this distribution, and is available at |
|---|
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
|---|
| 7 |
* |
|---|
| 8 |
* Contributors: |
|---|
| 9 |
* IBM Corporation - initial API and implementation |
|---|
| 10 |
* Port to the D programming language: |
|---|
| 11 |
* Frank Benoit <benoit@tionex.de> |
|---|
| 12 |
*******************************************************************************/ |
|---|
| 13 |
module dwt.custom.MovementEvent; |
|---|
| 14 |
|
|---|
| 15 |
import dwt.dwthelper.utils; |
|---|
| 16 |
|
|---|
| 17 |
import dwt.events.TypedEvent; |
|---|
| 18 |
import dwt.custom.StyledTextEvent; |
|---|
| 19 |
|
|---|
| 20 |
/** |
|---|
| 21 |
* This event is sent when a new offset is required based on the current |
|---|
| 22 |
* offset and a movement type. |
|---|
| 23 |
* |
|---|
| 24 |
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> |
|---|
| 25 |
* |
|---|
| 26 |
* @since 3.3 |
|---|
| 27 |
*/ |
|---|
| 28 |
public class MovementEvent : TypedEvent { |
|---|
| 29 |
|
|---|
| 30 |
/** |
|---|
| 31 |
* line start offset (input) |
|---|
| 32 |
*/ |
|---|
| 33 |
public int lineOffset; |
|---|
| 34 |
|
|---|
| 35 |
/** |
|---|
| 36 |
* line text (input) |
|---|
| 37 |
*/ |
|---|
| 38 |
public String lineText; |
|---|
| 39 |
|
|---|
| 40 |
/** |
|---|
| 41 |
* the current offset (input) |
|---|
| 42 |
*/ |
|---|
| 43 |
public int offset; |
|---|
| 44 |
|
|---|
| 45 |
/** |
|---|
| 46 |
* the new offset (input, output) |
|---|
| 47 |
*/ |
|---|
| 48 |
public int newOffset; |
|---|
| 49 |
|
|---|
| 50 |
/** |
|---|
| 51 |
* the movement type (input) |
|---|
| 52 |
* |
|---|
| 53 |
* @see dwt.DWT#MOVEMENT_WORD |
|---|
| 54 |
* @see dwt.DWT#MOVEMENT_WORD_END |
|---|
| 55 |
* @see dwt.DWT#MOVEMENT_WORD_START |
|---|
| 56 |
* @see dwt.DWT#MOVEMENT_CHAR |
|---|
| 57 |
* @see dwt.DWT#MOVEMENT_CLUSTER |
|---|
| 58 |
*/ |
|---|
| 59 |
public int movement; |
|---|
| 60 |
|
|---|
| 61 |
static final long serialVersionUID = 3978765487853324342L; |
|---|
| 62 |
|
|---|
| 63 |
/** |
|---|
| 64 |
* Constructs a new instance of this class based on the |
|---|
| 65 |
* information in the given event. |
|---|
| 66 |
* |
|---|
| 67 |
* @param e the event containing the information |
|---|
| 68 |
*/ |
|---|
| 69 |
public this(StyledTextEvent e) { |
|---|
| 70 |
super(cast(Object)e); |
|---|
| 71 |
lineOffset = e.detail; |
|---|
| 72 |
lineText = e.text; |
|---|
| 73 |
movement = e.count; |
|---|
| 74 |
offset = e.start; |
|---|
| 75 |
newOffset = e.end; |
|---|
| 76 |
} |
|---|
| 77 |
} |
|---|