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

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.GradientButton
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable, java.util.EventListener, org.eclipse.swt.events.MouseListener, org.eclipse.swt.internal.SWTEventListener

public class GradientButton
extends AbstractButton

This class displays a fill gradient. When the user clicks on it he can select from other known gradients

Version:
$Id: GradientButton.java,v 1.10 2005/03/23 08:07:55 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
GradientButton(org.eclipse.swt.widgets.Composite parent, int style, PaintItem pItem, UIManager uiManager)
          Constructor expects a paint item for initialization
 
Method Summary
protected  void draw(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle cArea)
          Draw the content.
 int getGradientBackground()
          Gets the gradient background color
 int getGradientForeground()
          Gets the gradient foreground color
 int getGradientType()
          Returns the gradient type.
 void mouseDown(org.eclipse.swt.events.MouseEvent me)
           
 void setColor(int color)
          Sets the background color of the gradient
protected  void widgetDisposed(org.eclipse.swt.events.DisposeEvent de)
          Called on dispose events.
 
Methods inherited from class com.tensegrity.gui.swt.control.buttons.AbstractButton
addSelectionListener, mouseDoubleClick, mouseUp, notifyListeners, removeSelectionListener
 
Methods inherited from class com.tensegrity.gui.swt.control.widgets.BorderedWidget
computeSize, 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, dispose, 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

GradientButton

public GradientButton(org.eclipse.swt.widgets.Composite parent,
                      int style,
                      PaintItem pItem,
                      UIManager uiManager)
Constructor expects a paint item for initialization

Parameters:
parent - the composite to add this GradientButton to
style - the SWT style bits
pItem - with the initial gradient type
uiManager - the UIManager used for internationalization
Method Detail

getGradientBackground

public final int getGradientBackground()
Gets the gradient background color

Returns:
background color encoded as Tensegrity Color Format

getGradientForeground

public final int getGradientForeground()
Gets the gradient foreground color

Returns:
foreground color encoded as Tensegrity Color Format

getGradientType

public final int getGradientType()
Returns the gradient type. Right now SWT natively supports only vertical and horizontal directions.

Returns:
the gradient type

setColor

public final void setColor(int color)
Sets the background color of the gradient

Parameters:
color - the background color in Tensegrity color format

mouseDown

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

widgetDisposed

protected void widgetDisposed(org.eclipse.swt.events.DisposeEvent de)
Description copied from class: BorderedWidget
Called on dispose events. Implementing classes should release all their requested resources

Overrides:
widgetDisposed in class AbstractButton

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


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