-//
-// FlatBezelObjectCell.swift
-// Flat Bezel
-//
-// Created by Ruben Beltran del Rio on 2/8/23.
-// Copyright © 2023 BRNBW. All rights reserved.
-//
-/*
-import Foundation
-import Cocoa
-
-class FlatBezelObjectCell: QSObjectCell {
- let preferredImagePosition: NSControl.ImagePosition = .imageAbove
-
- override func draw(withFrame cellFrame: NSRect, in controlView: NSView!) {
- let isFirstResponder = controlView.window?.firstResponder == controlView && !controlView.isKind(of: NSTableView.self)
-
- let dropTarget = self.isHighlighted && self.highlightsBy.contains(NSCell.StyleMask.changeBackgroundCellMask) && !self.isBezeled
-
- var fillColor: NSColor = self.backgroundColor ?? .textBackgroundColor
- if (isFirstResponder) {
- fillColor = self.highlightColor()
- }
- if (dropTarget) {
- fillColor = NSColor(red: 0.77, green: 0.91, blue: 0.96, alpha: 1)
- }
-
- var strokeColor: NSColor = .clear
-
- fillColor.setFill()
- strokeColor.setStroke()
-
- let roundRect = NSBezierPath()
- roundRect.appendRoundedRect(cellFrame, xRadius: cellRadiusFactor(), yRadius: cellRadiusFactor())
- roundRect.fill()
-
- self.drawInterior(withFrame: self.drawingRect(forBounds: cellFrame), in: controlView)
- }
-
- override func titleRect(forBounds rect: NSRect) -> NSRect {
- super.titleRect(forBounds: rect.offsetBy(dx: 0, dy: -4))
- }
-
- override func drawText(for drawObject: QSObject!, withFrame cellFrame: NSRect, in controlView: NSView!) {
- if self.imagePosition == .imageOnly {
- return;
- }
-
- var abbrString: String? = nil
- if controlView.responds(to: #selector(QSSearchObjectView.matchedString)) {
- abbrString = (controlView as! QSSearchObjectView).matchedString()
- }
-
- var nameString: String? = drawObject.displayName()
- var hitMask: AutoreleasingUnsafeMutablePointer<NSIndexSet?>? = nil
-
- var ranker = drawObject.ranker()
- if let ranker, let abbrString {
- nameString = ranker.matchedString(forAbbreviation: abbrString, hitmask: hitMask, inContext: nil)
- }
-
- var rankedStringIsName = nameString == drawObject.displayName()
- if nameString == nil {
- nameString = drawObject.identifier() ?? "Unknown"
- }
-
- var useAlternateColor = false
- if let controlView = controlView as? NSTableView {
- useAlternateColor = controlView.isRowSelected(controlView.row(at: cellFrame.origin))
- }
-
- var mainColor: NSColor? = textColor()
- if mainColor == nil {
- mainColor = useAlternateColor ? .alternateSelectedControlTextColor : .controlTextColor
- }
-
- var fadedColor = mainColor!.withAlphaComponent(0.50)
- var textDrawRect = titleRect(forBounds: cellFrame)
-
- var titleString = NSMutableAttributedString(string: nameString!)
- titleString.setAttributes(rankedStringIsName ? nameAttributes : detailAttributes, range: NSMakeRange(0, titleString.length))
-
- if abbrString != nil && abbrString!.hasPrefix("QSActionMnemonic") {
- titleString.addAttribute(.foregroundColor, value: rankedStringIsName ? fadedColor : fadedColor.withAlphaComponent(0.8), range: NSMakeRange(0, titleString.length))
- } else {
- var i = 0
- var j = 0
- var hits: [Int] = []
- count = hitMask?.
- }
- }
-}
-
-
- NSUInteger i = 0;
- NSUInteger j = 0;
- NSUInteger hits[[titleString length]];
- NSUInteger count = [hitMask getIndexes:(NSUInteger *)&hits maxCount:[titleString length] inIndexRange:nil];
- NSDictionary *attributes = @{
- NSForegroundColorAttributeName: rankedStringIsName ? mainColor : fadedColor
- };
- for(i = 0; i<count; i += j) {
- for (j = 1; i+j<count && hits[i+j-1] +1 == hits[i+j]; j++);
- [titleString addAttributes:attributes range:NSMakeRange(hits[i], j)];
- }
- } else {
- [titleString addAttribute:NSBaselineOffsetAttributeName value:[NSNumber numberWithDouble:-1.0] range:NSMakeRange(0, [titleString length])];
- }
-
- if (showDetails) {
- NSString *detailsString = [drawObject details];
-
- NSRange returnRange = [detailsString rangeOfString:@"\n"];
- if (returnRange.location != NSNotFound) {
- detailsString = [detailsString substringToIndex:returnRange.location];
- }
-
- detailsAttributes = [detailsAttributes mutableCopy];
- [detailsAttributes setValue:[NSColor grayColor] forKey:NSForegroundColorAttributeName];
-
- if (detailsString && detailsString.length && ![detailsString isEqualToString:nameString]) {
- [titleString appendAttributedString:[[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"\n%@",detailsString] attributes:detailsAttributes] autorelease]];
- }
- }
-
- NSRect centerRect = rectFromSize([titleString size]);
- centerRect.size.width = NSWidth(textDrawRect);
- centerRect.size.height = MIN(NSHeight(textDrawRect), centerRect.size.height);
- [titleString drawInRect:centerRectInRect(centerRect, textDrawRect)];
-}
-
-@end
-*/