Skip to content

XUIInspectorColorGroupItem

Implements XUIInspectorItem

Description

An item containing a two colour swatches and a caption. Used to set ColorGroups for light and dark mode applications.

Properties

Name Type Read-Only
Caption String
CaptionWidth Integer
DarkColorLabelText String
LightColorLabelText String
mActiveSwatch ActiveSwatches
mBounds Rect
mCaption String
mColorPickerVisible Boolean
mDarkSwatchBounds Rect
mData Variant
mID String
mLightSwatchBounds Rect
mSection WeakRef
mValue ColorGroup
Value ColorGroup

Methods

Name Parameters Returns
Bounds Rect
Bounds Assigns b As Rect
CanAcceptTab Boolean
Constructor ID As String, caption As String, captionWidth As Integer, value As ColorGroup, lightColorLabelText As String, darkColorLabelText As String
Data Variant
Data Assigns v As Variant
DidReceiveBackTab
DidReceiveTabFocus
DrawSwatchesAndSetBounds g As Graphics, x As Double, lightY As Double, darkY As Double, w As Double, h As Double
DrawSwatchLabels x As Double, lightY As Double, darkY As Double, w As Double, h As Double, lightBaseline As Double, darkBaseline As Double, g As Graphics, style As XUIInspectorStyle
Height style As XUIInspectorStyle Double
ID String
LostFocus
MouseDown x As Integer, y As Integer, clickType As XUI.ClickTypes XUIInspectorMouseDownData
MouseExit Boolean
MouseMoved x As Double, y As Double XUIInspectorMouseMoveData
MouseUp x As Integer, y As Integer, clickType As XUI.ClickTypes XUIInspectorMouseUpData
Owner XUIInspector
PickerClosing picker As XUIColorPicker
PopupDismissed
PopupItemSelected index As Integer
Render g As Graphics, x As Double, y As Double, width As Double, style As XUIInspectorStyle Double
Section XUIInspectorSection
Section Assigns section As XUIInspectorSection
SwatchHeight style As XUIInspectorStyle Double

Constants

Name Type
HPADDING Double
SWATCH_CAPTION_INTERNAL_PADDING Double
SWATCH_VPADDING Double
VPADDING Double

HPADDING As Double The number of pixels to pad the item's content left and right.


SWATCH_CAPTION_INTERNAL_PADDING As Double The number of pixels to pad the left and right of a swatch caption from its borders.


SWATCH_VPADDING As Double The height of the swatch is the height of the caption plus this value.


VPADDING As Double The number of pixels to pad the item's content above and below.


Enumerations

ActiveSwatches

The type of currently active swatch.

Name
None
Light
Dark

Property Descriptions

Caption As String

The caption to display besides the colour swatches.


CaptionWidth As Integer

The width the caption should be constrained to.


DarkColorLabelText As String

The label text to use to indicate the dark colour swatch.


LightColorLabelText As String

The label text to use to indicate the light colour swatch.


mActiveSwatch As ActiveSwatches

The currently active swatch.


mBounds As Rect

The bounds of this item.


mCaption As String

The caption to display besides the colour swatches.


mColorPickerVisible As Boolean

True if the color picker is visible.


mDarkSwatchBounds As Rect

The bounds of the dark mode colour swatch. Used for hit-testing.


mData As Variant

Arbitrary data associated with this item.


mID As String

Used to identify this item in notifications. You should ensure it is unique within the inspector.


mLightSwatchBounds As Rect

The bounds of the light mode colour swatch. Used for hit-testing.


mSection As WeakRef

A weak reference to the inspector section this item is within. May be Nil.


mValue As ColorGroup

The value as a ColorGroup.


Value As ColorGroup

The value as a ColorGroup.


Method Descriptions

Bounds() As Rect

The bounds of this item within the inspector.


Bounds(Assigns b As Rect)

Sets the bounds of this item in the inspector.


CanAcceptTab() As Boolean

Returns True if this item is able to accept the focus via the tab key.


Constructor(ID As String, caption As String, captionWidth As Integer, value As ColorGroup, lightColorLabelText As String, darkColorLabelText As String)

Constructs a new item containing a colour swatch which can be altered by clicking it. value is the initial ColorGroup.


Data() As Variant

Arbitrary data associated with this item.


Data(Assigns v As Variant)

Arbitrary data associated with this item.


DidReceiveBackTab()

This item has just received the focus via the shift-tab key combo (the "back tab").

Part of the XUIInspectorItem interface.


DidReceiveTabFocus()

This item has just received the focus via the tab key.


DrawSwatchesAndSetBounds(g As Graphics, x As Double, lightY As Double, darkY As Double, w As Double, h As Double)

Draws the colour swatches g and updates their bounds. lightY is the Y coordinate of the top swatch (the light swatch). darkY is the Y coordinate of the bottom swatch (the dark swatch).


DrawSwatchLabels(x As Double, lightY As Double, darkY As Double, w As Double, h As Double, lightBaseline As Double, darkBaseline As Double, g As Graphics, style As XUIInspectorStyle)

Draw the swatch labels to g. lightY is the Y coordinate for the light label and darkY is the Y coordinate for the dark label.


Height(style As XUIInspectorStyle) As Double

The height of this item given the desired style.

Part of the XUIInspectorItem interface.


ID() As String

Used to identify this item in notifications. You should ensure it is unique within the inspector.


LostFocus()

This item just lost the focus.

Part of the XUIInspectorItem interface.


MouseDown(x As Integer, y As Integer, clickType As XUI.ClickTypes) As XUIInspectorMouseDownData

Tells the item that a mouse down event has occurred within its bounds. x, y are the absolute coordinates relative to the inspector (adjusted for scrolling). Returns a MouseDownData instance instructing the inspector how to handle the event or Nil if the click didn't happen in this item.


MouseExit() As Boolean

Used to tell this item that the mouse has just exited it. Returns True if the inspector should redraw.

Part of the XUIInspectorItem interface.


MouseMoved(x As Double, y As Double) As XUIInspectorMouseMoveData

The mouse has just moved over this item. Returns data to inform the inspector how to handle the movement. May return Nil.

Part of the XUIInspectorItem interface.


MouseUp(x As Integer, y As Integer, clickType As XUI.ClickTypes) As XUIInspectorMouseUpData

Tells the item that a mouse up event has occurred within its bounds. x, y are the absolute coordinates relative to the inspector (adjusted for scrolling). Returns a MouseUpData instance instructing the inspector how to handle the event or Nil if the click didn't happen in this item.


Owner() As XUIInspector

A weak reference to the inspector this item belongs to.


PickerClosing(picker As XUIColorPicker)

Delegate called when a color swatch's color picker is closing.


PopupDismissed()

Tells this item that any popup it thinks it has displayed has been dismissed with no action.

Part of the XUIInspectorItem interface.


PopupItemSelected(index As Integer)

The entry at index has been selected in this item's popup menu.

Part of the XUIInspectorItem interface.


Render(g As Graphics, x As Double, y As Double, width As Double, style As XUIInspectorStyle) As Double

The item should render itself to the passed graphics context at the specified location. Returns the position of the item's bottom edge.

Part of the XUIInspectorItem interface.

|-----------------------------|
| CAPTION   L [ LIGHT COLOR ] |
|           D [ DARK COLOR  ] |
|-----------------------------|

```nohighlight

Section() As XUIInspectorSection

A weak reference to the section this item is in.


Section(Assigns section As XUIInspectorSection)

The section this item is within to. A weak reference will be created.


SwatchHeight(style As XUIInspectorStyle) As Double

The height of the swatch given the current style.