Package com.iizigo.swt
Class ColorSelectionWidget
java.lang.Object
com.iizigo.swt.ColorSelectionWidget
The color selection widget is a toolbar drop-down button that displays the color selection. If you press the drop-down button itself, the Color Dialog is shown to select the color.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorsConstructorDescriptionColorSelectionWidget(int color, boolean isTransparent, int backgroundColor, int transparentColor) Constructs the Color Selection Widget.Method Summary
Modifier and TypeMethodDescriptioncreateToolItem(ToolBar toolBar, int width, int height) Creates a toolbar item as widget.createWidget(Composite parent, int width, int height) Creates a stand-alone widget for a dialog.Gets the attachment object.intgetColor()Gets the selected color.voidHides the drop-down.voidonNewColor(int color) A new color is set: set in preview.voidSets an attachment object.voidsetColor(int color) Sets a new color.voidsetSelectionListener(IColorSelectionWidget listener) Sets the single selection listener.voidAssigns a widget to set the color into.voidAssigns a widget to set the color into.voidAssigns a widget to set the color into with a callback to set the new color when changed.voidShows the drop-down with color selection.
Constructor Details
ColorSelectionWidget
public ColorSelectionWidget(int color, boolean isTransparent, int backgroundColor, int transparentColor) Constructs the Color Selection Widget.- Parameters:
color- The color.isTransparent- Flag for transparency.backgroundColor- The background color, -1 for Widget color.transparentColor- The "transparency" color to use for GraphicsGC, -1 for none.
Method Details
setColor
public void setColor(int color) Sets a new color.setSelectionListener
Sets the single selection listener.setAttachment
Sets an attachment object.getAttachment
Gets the attachment object.createToolItem
Creates a toolbar item as widget.- Parameters:
toolBar- The tool bar.width- The width of the preview image.height- The height of the preview image.
createWidget
Creates a stand-alone widget for a dialog. The widget is a tool bar containing a single drop-down tool item.setWidget
Assigns a widget to set the color into.- Parameters:
shell- The shell for the widget.widget- The widget, can be any widget supportingsetImage().margin- The margin in the image, to force widget size larger, used e.g. for ToolItem's.
setWidget
Assigns a widget to set the color into with a callback to set the new color when changed.- Parameters:
shell- The shell for the widget.widget- The widget, can be any widget supportingsetImage().updater- The updater.
setWidget
public void setWidget(Shell shell, TableItem widget, int columnIndex, int width, int height, int margin) Assigns a widget to set the color into.- Parameters:
shell- The shell for the widget.widget- The TableItem widget with column image support.columnIndex- Column index, -1 to set the image for the TableItem directly.margin- The margin in the image, to force widget size larger, used e.g. for ToolItem's.
onNewColor
public void onNewColor(int color) A new color is set: set in preview.getColor
public int getColor()Gets the selected color.hideDropDown
public void hideDropDown()Hides the drop-down.showDropDown
public void showDropDown()Shows the drop-down with color selection.