GanttChartHeaderController

public class GanttChartHeaderController

Provides support for displaying the header rows of a Gantt Chart diagram, considering a specific timeline, viewport (to horizontally filter visible time areas on), and hour width value (controlling the horizontal zoom level), and offering supplemental information such as the total diagram size for further virtualizing diagram viewing. Used as common user interface service provider for GanttChartHeader components for macOS and iOS.

  • Initializes a controller with an optional scrollable timeline interval defined (by default the current week’s interval is used).

    Declaration

    Swift

    public init(scrollableTimeline: TimeRange? = nil)
  • Allows the developer to set a specific horizontal size (as timeline) for the diagram header.

    Declaration

    Swift

    public var scrollableTimeline: TimeRange { get set }
  • Schedule object that indicates the time intervals that should be displayed in the diagram header. By default it is set to the continuous schedule, indicating that all time is visible. Other schedule values that are often used include: fullWeek (all days of the week but only daytime between 8 AM and 4 PM) and standard (Monday to Friday, 8 AM to 4 PM).

    Declaration

    Swift

    public var visibilitySchedule: ScheduleDefinition { get set }
  • Allows the developer to optionally select the headers rows dynamically, based on input hour width value (e.g. to select weeks and days when hour width is larger, but months and weeks when the end user zooms out and the hour width becomes smaller). When the rows selector is defined and provides a value for the current hour width, that array overrides the default rows array.

    Declaration

    Swift

    public var rowSelector: GanttChartHeaderRowSelector? { get set }
  • Defines the default rows of the diagram header, identifying the arrays of time intervals and associated label formats to be used for each of them. By default, weeks and days (formatted as day of week abbreviations) are displayed. May be overridden by using rowSelector.

    Declaration

    Swift

    public var rows = [GanttChartHeaderRow(.weeks),
                       GanttChartHeaderRow(.days, format: .dayOfWeekShortAbbreviation)]
  • Determines the actual rows to be displayed in the diagram header.

    Declaration

    Swift

    public var actualRows: [GanttChartHeaderRow] { get }
  • Determines the count of the actual rows that are to be displayed in the diagram header.

    Declaration

    Swift

    public var rowCount: Int { get }
  • Determines the height of a row in the diagram header by dividing the viewport’s height (assumed to be the diagram header’s total height) to the actual row count.

    Declaration

    Swift

    public var rowHeight: Double { get }
  • Indicates the width of an hour of time in the diagram header. Use a smaller value to display more time in the same space (getting shorter time labels as well), and a larger one to display less time (getting long time labels instead).

    Declaration

    Swift

    public var hourWidth: Double { get set }
  • Horizontal scale factor to further apply to the timeline (used to compute the actual hour width).

    Declaration

    Swift

    public var zoom: Double { get set }
  • Sets the zoom level coercing the value to be between the minZoom and maxZoom values specified in settings.

    Declaration

    Swift

    public func setZoom(coercing value: Double) -> Double
  • Returns the actual hour width value used for the timeline of the diagram header, applying the current zoom level to the specified hour width of the controller.

    Declaration

    Swift

    public var actualHourWidth: Double { get }
  • Indicates the horizontal part of the diagram header that should be visible on screen, and defines the total vertical size of the diagram header. Set by the associated user interface component to reflect the content size of the horizontal scroll view that presents the diagram header, to improve the runtime performance of the system.

    Declaration

    Swift

    public var viewport: Rectangle { get set }
  • Returns the total size that the diagram header would require to be fully displayed on screen. Accessed by the associated user interface component to set up the content placeholder within the horizontal scroll view that presents the diagram header, it is computed based on the specified visibility schedule, actual timeline, actual hour width, and viewport height values of the controller. The value is internally cached until any of its input arguments changes in order to improve output performance.

    Declaration

    Swift

    public var totalDiagramHeaderSize: Size { get }
  • Returns the X coordinate of a specific date-time in the diagram header.

    Declaration

    Swift

    public func x(of time: Time) -> Double
  • Returns the width of a specific date-time interval in the diagram header.

    Declaration

    Swift

    public func width(of time: TimeRange) -> Double
  • Returns the top Y coordinate of a specific row in the diagram header.

    Declaration

    Swift

    public func top(of row: Row) -> Double
  • Returns the middle Y coordinate of a specific row in the diagram header.

    Declaration

    Swift

    public func middle(of row: Row) -> Double
  • Returns the bottom Y coordinate of a specific row in the diagram header.

    Declaration

    Swift

    public func bottom(of row: Row) -> Double
  • Returns the date-time value for a specific X coordinate in the diagram header.

    Declaration

    Swift

    public func time(of x: Double) -> Time
  • Returns the row value for a specific Y coordinate in the diagram header.

    Declaration

    Swift

    public func row(of y: Double) -> Int
  • Returns the visible timeline in the diagram header, considering the current viewport.

    Declaration

    Swift

    public var visibleTimeline: TimeRange { get }
  • Returns the timeline in the diagram header for the specified rectangular bounds.

    Declaration

    Swift

    public func timeline(for bounds: Rectangle) -> TimeRange
  • Returns the timeline in the diagram header for the specified left coordinate and width.

    Declaration

    Swift

    public func timeline(left: Double, width: Double) -> TimeRange
  • Objects that indicate the scheduled working or nonworking time intervals to be highlighted in the diagram header.

    Declaration

    Swift

    public var scheduleHighlighters: [ScheduleTimeSelector] { get set }
  • Returns the highlighted schedule areas to be drawn in the viewport of the diagram header. The array is internally cached until any of its input arguments changes in order to improve output performance.

    Declaration

    Swift

    public var highlightedScheduleAreas: [ScheduleTimeArea] { get }
  • Returns the highlighted schedule areas to be drawn in the specified rectangular area of the diagram header.

    Declaration

    Swift

    public func highlightedScheduleAreas(in area: Rectangle) -> [ScheduleTimeArea]
  • Returns the row cells to be drawn in the viewport of the diagram header. The array is internally cached until any of its input arguments changes in order to improve output performance.

    Declaration

    Swift

    public var cells: [GanttChartHeaderCell] { get }
  • Returns the row cells to be drawn in the specified rectangular area of the diagram.

    Declaration

    Swift

    public func cells(in area: Rectangle) -> [GanttChartHeaderCell]
  • Returns the bounds for a cell area spanning the specified time interval, and being associated to the specified row in the diagram header.

    Declaration

    Swift

    public func bounds(for time: TimeRange, row: Row! = nil) -> Rectangle
  • Defines settings for the component, including behavioral and style setters.

    Declaration

    Swift

    public var settings: GanttChartHeaderSettings
  • User interface style settings for the component.

    Declaration

    Swift

    public var style: GanttChartHeaderStyle { get set }
  • Draws the part of the diagram header that matches the specified area, with support from the presenter delegate (by default, the user interface component).

    Declaration

    Swift

    public func draw(within area: Rectangle)
  • Begins dragging at a specific point in the diagram header, allowing the end user to perform zooming operations (preserving the central time in the viewport).

    Declaration

    Swift

    public func beginDragging(at point: Point)
  • Continues the current dragging operation towards a specific point in the diagram header (preserving the central time in the viewport).

    Declaration

    Swift

    public func continueDragging(to point: Point)
  • Ends the current dragging (zooming) operation.

    Declaration

    Swift

    public func endDragging()
  • Indicates the initial X coordinate during a dragging operation (actually performing zooming).

    Declaration

    Swift

    public private(set) var draggingFromX: Double?
  • Indicates the initial zoom level during a dragging operation (actually performing zooming).

    Declaration

    Swift

    public private(set) var zoomingFrom: Double?
  • Indicates the centrally visible time during a dragging operation (actually performing zooming and preserving the central time in the viewport).

    Declaration

    Swift

    public private(set) var zoomingTime: Time?
  • Scrolls the diagram header to ensure the specified time interval (with margin, if set) is visible in the viewport, with support from the scroller delegate (by default, the user interface component).

    Declaration

    Swift

    public func scroll(to interval: TimeRange, margin: Double? = nil)
  • Scrolls the diagram header to ensure the specified time (with margin, if set) is visible in the viewport, with support from the scroller delegate (by default, the user interface component).

    Declaration

    Swift

    public func scroll(to time: Time, margin: Double? = nil)
  • Scrolls the diagram header by the specified horizontal coordinate difference, with support from the scroller delegate (by default, the user interface component).

    Declaration

    Swift

    public func scrollBy(dx: Double = 0)
  • Computes the central time of the visible timeline given the current viewport of the diagram header.

    Declaration

    Swift

    public var visibleTimelineCenter: Time { get }
  • Scrolls the diagram header to ensure the specified time is centered in the viewport, with support from the scroller delegate (by default, the user interface component).

    Declaration

    Swift

    public func scrollVisibleTimeline(toCenterOn value: Time)
  • Scrolls the diagram header to ensure the specified time is on the left side of the viewport, with support from the scroller delegate (by default, the user interface component).

    Declaration

    Swift

    public func scrollVisibleTimeline(toStartOn value: Time)
  • Scrolls the diagram header to ensure the specified time is on the right side of the viewport, with support from the scroller delegate (by default, the user interface component).

    Declaration

    Swift

    public func scrollVisibleTimeline(toFinishOn value: Time)
  • Initializes periodic auto-refreshing of the user interface (useful when current time is displayed in the diagram header).

    Declaration

    Swift

    public func initializeAutoRefreshTimer(interval: Double, in unit: TimeUnit = .seconds)
  • Disables periodic auto-refreshing. Must be used in order to avoid memory leaks when periodic auto-refreshing has been initialized.

    Declaration

    Swift

    public func invalidateAutoRefreshTimer()
  • Notifies the controller object that the settings have changed due to external causes.

    Declaration

    Swift

    public func settingsDidChange()
  • Specifies the style set to use upon presentation time. (By default, it is set to standard.)

    Declaration

    Swift

    public var theme: Theme { get set }
  • Specifies the mode (such as light or dark) to adapt the theme to upon presentation time. (By default, it is not set, and the effective appearance of the view is converted into an appropriate mode value, at runtime.)

    Declaration

    Swift

    public var mode: Mode? { get set }
  • Optional mode provider to determine the actual mode (such as light or dark) when mode value is not set. (By default, the user interface component.)

    Declaration

    Swift

    public var modeProvider: ModeProvider? { get set }
  • Returns the actual mode (such as light or dark) to adapt the theme to upon presentation time, considering mode value, the mode provider, or the default value (light).

    Declaration

    Swift

    public var actualMode: Mode { get }
  • Returns the style to be used upon selecting the specified custom theme.

    Declaration

    Swift

    public func styleForTheme(_ name: String,
                              mode: Mode? = nil) -> GanttChartHeaderStyle?
  • Sets the style to be used upon selecting the specified custom theme.

    Declaration

    Swift

    public func setStyleForTheme(_ name: String, mode: Mode? = nil,
                                 to value: GanttChartHeaderStyle?)
  • Optional observer delegate for the controller (usually the user interface component).

    Declaration

    Swift

    public weak var observer: GanttChartHeaderObserver?
  • Optional row array observer delegate for the controller (usually a container controller).

    Declaration

    Swift

    public weak var rowArrayObserver: GanttChartHeaderRowArrayObserver?
  • Optional timeline observer delegate for the controller (usually a container controller).

    Declaration

    Swift

    public weak var timelineObserver: GanttChartHeaderTimelineObserver?
  • Optional scroller delegate for the controller (usually the user interface component).

    Declaration

    Swift

    public weak var scroller: GanttChartHeaderScroller?
  • Optional presenter delegate for the controller (usually the user interface component or a container controller).

    Declaration

    Swift

    public weak var presenter: GanttChartHeaderPresenter?
  • Optional viewport observer delegate for the controller.

    Declaration

    Swift

    public weak var viewportObserver: GanttChartHeaderViewportObserver?
  • Optional style provider delegate to use for further customizing the style of the component, supporting runtime theme and mode changes.

    Declaration

    Swift

    public weak var styleProvider: GanttChartHeaderStyleProvider?
  • Optional style observer delegate to use for identifying runtime style updates (such as upon changing mode).

    Declaration

    Swift

    public weak var styleObserver: GanttChartHeaderStyleObserver?