Class SwatchesTab
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
com.iizigo.prop.editor.color.swt.SwatchesTab
- All Implemented Interfaces:
Drawable
The Swatches tab of the SWT color chooser (CC-COLOR-CHOOSER-SWT-PANELS, 2026-10-10): the generated palette (
SwatchPalette, 31 by 9) and, to its right under a "Recent:" label, the recently picked colors (RecentColors, 5 by 7). A pick on either grid sets the chooser's color opaque (ruling SC-D-5: a swatch replaces the alpha) and moves the color to the front of the recents, which the chooser persists.The two grids and the label form one block, centred in the tab, and the cells of both grids follow the tab's size (CC-FIX-SWATCHES-SCALE, 2026-10-28): the largest cell at which the block and its margins fit, from ChooserMetrics.MIN_CELL up to ChooserMetrics.MAX_CELL_SCALE times the reference cell. The tab's preferred size is the block at the reference cell, so the chooser opens at the size it always had.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of recent colors kept: the cells of the recent grid.static final intThe recent grid columns and rows.static final intConstructor Summary
ConstructorsConstructorDescriptionSwatchesTab(Composite parent, ColorChooserComposite chooser, RecentColors recent, Font font, int fontHeight, ChooserColors colors) Creates the tab.Method Summary
Modifier and TypeMethodDescriptionGets the palette grid.Gets the recent grid.Gets the label of the recent grid.voidThe recent colors changed: the recent grid is redrawn.voidsetCellSize(int cell) Sets the reference cell size in points, at leastChooserMetrics.MIN_CELL, and lays the tab out again: the tab's preferred size is the block at this cell, and the cells shown follow the tab's size up toChooserMetrics.MAX_CELL_SCALEtimes it.Methods inherited from class Composite
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setAutoscalingMode, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setDataMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Drawable
isAutoScalable
Field Details
RECENT_COLUMNS
public static final int RECENT_COLUMNSThe recent grid columns and rows.- See Also:
RECENT_ROWS
public static final int RECENT_ROWS- See Also:
RECENT_CAPACITY
public static final int RECENT_CAPACITYThe number of recent colors kept: the cells of the recent grid.- See Also:
Constructor Details
SwatchesTab
public SwatchesTab(Composite parent, ColorChooserComposite chooser, RecentColors recent, Font font, int fontHeight, ChooserColors colors) Creates the tab.- Parameters:
parent- The parent.chooser- The chooser.recent- The recent colors.font- The dialog font, or null for the default.fontHeight- The height of the dialog font's metrics in points, for the cell size.colors- The theme colors: this page's background, the grids' background and cell shade lines.
Method Details
getPaletteGrid
Gets the palette grid.getRecentGrid
Gets the recent grid.getRecentLabel
Gets the label of the recent grid.recentChanged
public void recentChanged()The recent colors changed: the recent grid is redrawn.setCellSize
public void setCellSize(int cell) Sets the reference cell size in points, at leastChooserMetrics.MIN_CELL, and lays the tab out again: the tab's preferred size is the block at this cell, and the cells shown follow the tab's size up toChooserMetrics.MAX_CELL_SCALEtimes it.