Skip to content

Commit

Permalink
Rename internal segment types
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbaird committed Dec 18, 2023
1 parent a51f08e commit cfb36bb
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Sources/ColorWellKit/Views/Cocoa/CWColorWellBaseControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public class _CWColorWellBaseControl: NSControl {
break
}
case .expanded:
size.width += CWColorWellToggleSegment.widthConstant
size.width += CWToggleSegment.widthConstant
switch controlSize {
case .large:
size.width += 8
Expand Down Expand Up @@ -242,7 +242,7 @@ extension _CWColorWellBaseControl {
// MARK: Accessibility
extension _CWColorWellBaseControl {
public override func accessibilityChildren() -> [Any]? {
if let toggleSegment = layoutView.segments.first(where: { $0 is CWColorWellToggleSegment }) {
if let toggleSegment = layoutView.segments.first(where: { $0 is CWToggleSegment }) {
return [toggleSegment]
}
return []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ class CWColorWellLayoutView: NSGridView {
resetLayoutView()
switch colorWell.style {
case .default:
segments.append(CWColorWellBorderedSwatchSegment(colorWell: colorWell))
segments.append(CWBorderedSwatchSegment(colorWell: colorWell))
widthConstant = 0
case .minimal:
segments.append(CWColorWellSinglePullDownSwatchSegment(colorWell: colorWell))
segments.append(CWSinglePullDownSwatchSegment(colorWell: colorWell))
widthConstant = 0
case .expanded:
segments.append(CWColorWellPartialPullDownSwatchSegment(colorWell: colorWell))
segments.append(CWColorWellToggleSegment(colorWell: colorWell))
segments.append(CWPartialPullDownSwatchSegment(colorWell: colorWell))
segments.append(CWToggleSegment(colorWell: colorWell))
widthConstant = -1
}
row = addRow(with: segments)
Expand All @@ -165,7 +165,7 @@ class CWColorWellLayoutView: NSGridView {

switch colorWell.style {
case .expanded:
let widthConstant = CWColorWellToggleSegment.widthConstant
let widthConstant = CWToggleSegment.widthConstant
bezelPath = Path.segmentPath(
rect: NSRect(
x: bounds.maxX - widthConstant,
Expand All @@ -174,7 +174,7 @@ class CWColorWellLayoutView: NSGridView {
height: bounds.height - lineWidth
),
controlSize: colorWell.controlSize,
segmentType: CWColorWellToggleSegment.self,
segmentType: CWToggleSegment.self,
shouldClose: false
)
.stroked(lineWidth: lineWidth)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//
// CWColorWellBorderedSwatchSegment.swift
// CWBorderedSwatchSegment.swift
// ColorWellKit
//

import AppKit

/// A segment that displays a color swatch with the color well's current
/// color selection, and that toggles the color panel when pressed.
class CWColorWellBorderedSwatchSegment: CWColorWellSwatchSegment {
class CWBorderedSwatchSegment: CWSwatchSegment {

// MARK: Properties

Expand Down Expand Up @@ -44,7 +44,7 @@ class CWColorWellBorderedSwatchSegment: CWColorWellSwatchSegment {
// MARK: Methods

override class func performAction(for segment: CWColorWellSegment) -> Bool {
CWColorWellToggleSegment.performAction(for: segment)
CWToggleSegment.performAction(for: segment)
}

override func drawSwatch() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//
// CWColorWellPullDownSwatchSegment.swift
// CWPullDownSwatchSegment.swift
// ColorWellKit
//

import AppKit

// MARK: - CWColorWellPullDownSwatchSegment
// MARK: - CWPullDownSwatchSegment

/// A segment that displays a color swatch with the color well's current
/// color selection, and that triggers a pull-down action when pressed.
class CWColorWellPullDownSwatchSegment: CWColorWellSwatchSegment {
class CWPullDownSwatchSegment: CWSwatchSegment {

// MARK: Properties

Expand Down Expand Up @@ -49,7 +49,7 @@ class CWColorWellPullDownSwatchSegment: CWColorWellSwatchSegment {
!segment.canPerformAction || NSEvent.modifierFlags.contains(.shift)
{
// can't perform the standard action; treat like a toggle segment
return CWColorWellToggleSegment.performAction(for: segment)
return CWToggleSegment.performAction(for: segment)
}

if
Expand Down Expand Up @@ -208,18 +208,18 @@ class CWColorWellPullDownSwatchSegment: CWColorWellSwatchSegment {
}
}

// MARK: - CWColorWellSinglePullDownSwatchSegment
// MARK: - CWSinglePullDownSwatchSegment

/// A pull down swatch segment that fills its color well.
class CWColorWellSinglePullDownSwatchSegment: CWColorWellPullDownSwatchSegment {
class CWSinglePullDownSwatchSegment: CWPullDownSwatchSegment {
override class var edge: Edge? { nil }

override var borderColor: NSColor { .placeholderTextColor }
}

// MARK: - CWColorWellPartialPullDownSwatchSegment
// MARK: - CWPartialPullDownSwatchSegment

/// A pull down swatch segment that does not fill its color well.
class CWColorWellPartialPullDownSwatchSegment: CWColorWellPullDownSwatchSegment {
class CWPartialPullDownSwatchSegment: CWPullDownSwatchSegment {
override class var edge: Edge? { .leading }
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//
// CWColorWellSwatchSegment.swift
// CWSwatchSegment.swift
// ColorWellKit
//

import AppKit

/// A segment that displays a color swatch with the color well's current
/// color selection.
class CWColorWellSwatchSegment: CWColorWellSegment {
class CWSwatchSegment: CWColorWellSegment {

// MARK: Types

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// CWColorWellToggleSegment.swift
// CWToggleSegment.swift
// ColorWellKit
//

import AppKit

// MARK: - CWColorWellToggleSegment
// MARK: - CWToggleSegment

/// A segment that toggles the system color panel when pressed.
class CWColorWellToggleSegment: CWColorWellSegment {
class CWToggleSegment: CWColorWellSegment {

// MARK: Types

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct ColorWellRepresentable: NSViewRepresentable {
break
}
case .expanded:
size.width += CWColorWellToggleSegment.widthConstant
size.width += CWToggleSegment.widthConstant
switch controlSize {
case .large:
size.width += 6
Expand Down

0 comments on commit cfb36bb

Please sign in to comment.