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 SummaryConstructorsConstructorDescription- ColorSelectionWidget- (int color, boolean isTransparent, int backgroundColor, int transparentColor) Constructs the Color Selection Widget.
- Method SummaryModifier and TypeMethodDescription- createToolItem- (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.- int- getColor()Gets the selected color.- voidHides the drop-down.- void- onNewColor- (int color) A new color is set: set in preview.- voidSets an attachment object.- void- setColor- (int color) Sets a new color.- void- setSelectionListener- (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- ColorSelectionWidgetpublic 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- setColorpublic void setColor- (int color) Sets a new color.
- setSelectionListenerSets the single selection listener.
- setAttachmentSets an attachment object.
- getAttachmentGets the attachment object.
- createToolItemCreates a toolbar item as widget.- Parameters:
- toolBar- The tool bar.
- width- The width of the preview image.
- height- The height of the preview image.
 
- createWidgetCreates a stand-alone widget for a dialog. The widget is a tool bar containing a single drop-down tool item.
- setWidgetAssigns a widget to set the color into.- Parameters:
- shell- The shell for the widget.
- widget- The widget, can be any widget supporting- setImage().
- margin- The margin in the image, to force widget size larger, used e.g. for ToolItem's.
 
- setWidgetAssigns 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 supporting- setImage().
- updater- The updater.
 
- setWidgetpublic 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.
 
- onNewColorpublic void onNewColor- (int color) A new color is set: set in preview.
- getColorpublic int getColor()Gets the selected color.
- hideDropDownpublic void hideDropDown()Hides the drop-down.
- showDropDownpublic void showDropDown()Shows the drop-down with color selection.