Example usage for com.google.gwt.user.client.ui Image addDragStartHandler

List of usage examples for com.google.gwt.user.client.ui Image addDragStartHandler

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Image addDragStartHandler.

Prototype

public HandlerRegistration addDragStartHandler(DragStartHandler handler) 

Source Link

Usage

From source file:org.daxplore.presenter.client.ui.ImageButton.java

License:Open Source License

/**
 * Instantiates a new image button./*w w  w .j a v  a2  s.  c o  m*/
 * 
 * @param buttonImage
 *            the image displayed on the button
 * @param titleText
 *            the title text, displayed on mouse over
 */
public ImageButton(Image buttonImage, String titleText) {
    this.buttonImage = buttonImage;
    buttonImage.setTitle(titleText);
    mainPanel = new SimplePanel();
    mainPanel.setWidget(buttonImage);
    mainPanel.setWidth(buttonImage.getWidth() + "px");
    mainPanel.setHeight(buttonImage.getHeight() + "px");
    initWidget(mainPanel);

    this.setStyleName("daxplore-ImageButton");

    // Prevent dragging of the button's image
    buttonImage.addDragStartHandler(new DragStartHandler() {
        @Override
        public void onDragStart(DragStartEvent event) {
            event.preventDefault();
        }
    });
}