//
//  GSGlyphViewControllerProtocol.h
//  GlyphsCore
//
//  Created by Georg Seifert on 11.09.09.
//  Copyright 2009 schriftgestaltung.de. All rights reserved.
//

@class GSLayer;
@class GSGlyph;

NS_ASSUME_NONNULL_BEGIN

/** This protocol defines the API for the main view controllers. This is implemented by the font view controller and the edit view controller.
 */

@protocol GSGlyphViewControllerProtocol

#ifndef GLYPHS_LITE
/// The index of the active master
@property (nonatomic) NSUInteger masterIndex;
/// The search query used to filter the masters list. An empty string indicates no filtering.
@property (nonatomic, strong) NSString *displayMastersSearchString;
/// The ID of the axis by which masters are grouped. A `nil` value indicates no grouping.
@property (nonatomic, strong, nullable) NSString *displayMastersPivotAxisId;
/// Elements of either `GSFontMaster *` or `GSAxisMasterGroup *`.
@property (strong, nonatomic, readonly) NSArray *displayMasters;

#endif

// all visible layers
@property (readonly, nonatomic) NSArray<GSLayer *> *allLayers;

/// The selected layers
@property (readonly, nonatomic) NSArray<GSLayer *> *selectedLayers;

/// The selected layers  but without triggering notifications and such
@property (readonly, nonatomic) NSArray<GSLayer *> *selectedLayersFast;

@property (readonly, nonatomic) NSArray<GSGlyph *> *selectedGlyphs;

/// The GSFont object
#if !TARGET_OS_IOS
@property (readonly, nonatomic, nullable) id representedObject;
#else // external access needed on ios; try to find a better solution
@property (readwrite, nonatomic, nullable) id representedObject;
#endif

/** The active layer

 If only one layer is selected it retunes it, otherwise it retunes nil.

 In the editView, this is the layer that has a gray info box.
 */
@property (readonly, nonatomic, nullable) GSLayer *activeLayer;

/** This is a copy of the layer while and drag operation or a filter dialog is active.

 It stores the original content objects of the layer, so please don’t change anything
 */
@property (strong, nonatomic, nullable) GSLayer *shadowLayer;

@property (readonly, nonatomic) NSView *contentView;

@property (nonatomic) CGFloat scale;

@optional
/** is called to determine if the "Show Info for Selection" menu item should be activated

 @return a bool
 */
- (BOOL)canShowInfoForSelection;
/** This is the action for the "Show Info for Selection" menu item.

 @param sender The caller, most likely the menu item
 */
- (IBAction)showInfoForSelection:(nullable id)sender;

- (IBAction)printDocument:(id)sender;

- (void)didGetSelected;

- (void)redraw;

- (void)reflow;

- (void)selectGlyphs:(NSArray<GSGlyph *> *)glyphs;

- (void)setBackgroundTintColor:(nullable NSColor *)color;

@end

NS_ASSUME_NONNULL_END
