 
 import AppKit
 
-final class StatableMenuToolbarItem: NSToolbarItem, StatableItem, Validatable {
+final class StatableMenuToolbarItem: NSMenuToolbarItem, StatableItem, Validatable {
     
     // MARK: Public Properties
     

        
        assert(self.state != .mixed)
        
        self.image = self.stateImages[self.state]
        self.menuFormRepresentation?.image = self.image
    }
    
}



final private class DropdownSegmentedControl: NSSegmentedControl {
    
    // MARK: Segmented Control Methods
    
    override class var cellClass: AnyClass? {
        
        get { DropdownSegmentedControlCell.self }
        set { _ = newValue }
    }
    
}



final private class DropdownSegmentedControlCell: NSSegmentedCell {
    
    // MARK: Segmented Cell Methods
    
    /// return `nil` for the last segment to popup context menu immediately when user clicked
    override var action: Selector? {
        
        get {
            guard self.menu(forSegment: self.selectedSegment) == nil else { return nil }
            
            return super.action
        }
        
        set {
            super.action = newValue
        }
    }
    
}

    var stateImages: [NSControl.StateValue: NSImage] = [:]  { didSet { self.invalidateImage() } }
    
    
    
    // MARK: -
    // MARK: Toolbar Item Methods
    
    override var image: NSImage? {
        
        get { super.image }
        @available(*, unavailable, message: "Set images through 'stateImages' instead.") set {  }
    }
    
    
    override func validate() {
        
        self.isEnabled = self.validate()
    }
    
    
