com.tensegrity.gui.swt.control.buttons
Class ImageButton

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended byorg.eclipse.swt.widgets.Canvas
                      extended bycom.tensegrity.gui.swt.control.widgets.BorderedWidget
                          extended bycom.tensegrity.gui.swt.control.buttons.AbstractButton
                              extended bycom.tensegrity.gui.swt.control.buttons.ImageButton
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable, java.util.EventListener, org.eclipse.swt.events.MouseListener, org.eclipse.swt.internal.SWTEventListener

public class ImageButton
extends AbstractButton

A flat button which can display an image. This implementation was required since we couldn't change the border color of the SWT button.

Version:
$Id: ImageButton.java,v 1.7 2005/08/16 09:54:07 ArndHouben Exp $
Author:
Arnd Houben

Field Summary
 
Fields inherited from class com.tensegrity.gui.swt.control.widgets.BorderedWidget
indent
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
ImageButton(org.eclipse.swt.widgets.Composite parent)
          Constructor for creating a default, imageless button with a border
ImageButton(org.eclipse.swt.widgets.Composite parent, int style)
          Use this constructor if you want to pass some style flags.
 
Method Summary
 org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
           
 void dispose()
           
protected  void draw(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle cArea)
          Draw the content.
 void mouseDown(org.eclipse.swt.events.MouseEvent e)
           
 void setImage(org.eclipse.swt.graphics.Image image)
          Sets the image which should be displayed on top of the button
 
Methods inherited from class com.tensegrity.gui.swt.control.buttons.AbstractButton
addSelectionListener, mouseDoubleClick, mouseUp, notifyListeners, removeSelectionListener, widgetDisposed
 
Methods inherited from class com.tensegrity.gui.swt.control.widgets.BorderedWidget
hasBorder, setBorderColor
 
Methods inherited from class org.eclipse.swt.widgets.Canvas
getCaret, scroll, setCaret, setFont
 
Methods inherited from class org.eclipse.swt.widgets.Composite
checkSubclass, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageButton

public ImageButton(org.eclipse.swt.widgets.Composite parent)
Constructor for creating a default, imageless button with a border

Parameters:
parent - the parent Composite to add this button to

ImageButton

public ImageButton(org.eclipse.swt.widgets.Composite parent,
                   int style)
Use this constructor if you want to pass some style flags. E.g SWT.NONE to disable the border painting

Parameters:
parent - the parent Composite to add this button to
style - SWT style bits
Method Detail

setImage

public final void setImage(org.eclipse.swt.graphics.Image image)
Sets the image which should be displayed on top of the button

Parameters:
image - the displayed image

draw

protected void draw(org.eclipse.swt.graphics.GC gc,
                    org.eclipse.swt.graphics.Rectangle cArea)
Description copied from class: BorderedWidget
Draw the content.

Specified by:
draw in class BorderedWidget
Parameters:
gc - the graphicd context to use for drawing
cArea - the area an implementing class can use for drawing

mouseDown

public void mouseDown(org.eclipse.swt.events.MouseEvent e)

computeSize

public org.eclipse.swt.graphics.Point computeSize(int wHint,
                                                  int hHint,
                                                  boolean changed)
Overrides:
computeSize in class BorderedWidget

dispose

public void dispose()


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.