1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
//
// SDLMenuCell.h
// SmartDeviceLink
//
// Created by Joel Fischer on 4/9/18.
// Copyright © 2018 smartdevicelink. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SDLMenuLayout.h"
#import "SDLTriggerSource.h"
@class SDLArtwork;
NS_ASSUME_NONNULL_BEGIN
/**
The handler to run when a menu item is selected.
@param triggerSource The trigger source of the selection
*/
typedef void(^SDLMenuCellSelectionHandler)(SDLTriggerSource triggerSource);
/// A menu cell item for the main menu or sub-menu.
@interface SDLMenuCell : NSObject
/**
The cell's text to be displayed
*/
@property (copy, nonatomic, readonly) NSString *title;
/**
The cell's icon to be displayed
*/
@property (strong, nonatomic, readonly, nullable) SDLArtwork *icon;
/**
The strings the user can say to activate this voice command
*/
@property (copy, nonatomic, readonly, nullable) NSArray<NSString *> *voiceCommands;
/**
The handler that will be called when the command is activated
*/
@property (copy, nonatomic, readonly, nullable) SDLMenuCellSelectionHandler handler;
/**
If this is non-nil, this cell will be a sub-menu button, displaying the subcells in a menu when pressed.
*/
@property (copy, nonatomic, readonly, nullable) NSArray<SDLMenuCell *> *subCells;
/**
The layout in which the `subCells` will be displayed.
*/
@property (strong, nonatomic, readonly, nullable) SDLMenuLayout submenuLayout;
/**
The cell's secondary text to be displayed
*/
@property (copy, nonatomic, readonly, nullable) NSString *secondaryText;
/**
The cell's tertiary text to be displayed
*/
@property (copy, nonatomic, readonly, nullable) NSString *tertiaryText;
/**
The cell's secondary icon to be displayed
*/
@property (strong, nonatomic, readonly, nullable) SDLArtwork *secondaryArtwork;
/**
Create a menu cell that has no subcells.
@param title The cell's primary text
@param icon The cell's image
@param voiceCommands Voice commands that will activate the menu cell
@param handler The code that will be run when the menu cell is selected
@return The menu cell
*/
- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon voiceCommands:(nullable NSArray<NSString *> *)voiceCommands handler:(SDLMenuCellSelectionHandler)handler __deprecated_msg("Use initWithTitle:secondaryText:tertiaryText:icon:secondaryArtwork:voiceCommands:handler: instead");
/**
Create a menu cell that has subcells and when selected will go into a deeper part of the menu
@param title The cell's primary text
@param icon The cell's image
@param layout The layout that the subCells will be layed out in if that submenu is entered
@param subCells The subcells that will appear when the cell is selected
@return The menu cell
*/
- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells __deprecated_msg("Use initWithTitle:secondaryText:tertiaryText:icon:secondaryArtwork:submenuLayout:subCells: instead");
/**
Create a menu cell that has no subcells.
@param title The cell's primary text
@param secondaryText - secondaryText
@param tertiaryText - tertiaryText
@param icon The cell's image
@param secondaryArtwork - secondaryArtwork
@param voiceCommands Voice commands that will activate the menu cell
@param handler The code that will be run when the menu cell is selected
@return The menu cell
*/
- (instancetype)initWithTitle:(NSString *)title secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText icon:(nullable SDLArtwork *)icon secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork voiceCommands:(nullable NSArray<NSString *> *)voiceCommands handler:(SDLMenuCellSelectionHandler)handler;
/**
Create a menu cell that has subcells and when selected will go into a deeper part of the menu
@param title The cell's primary text
@param secondaryText - secondaryText
@param tertiaryText - tertiaryText
@param icon The cell's image
@param secondaryArtwork - secondaryArtwork
@param layout The layout that the subCells will be layed out in if that submenu is entered
@param subCells The subcells that will appear when the cell is selected
@return The menu cell
*/
- (instancetype)initWithTitle:(NSString *)title secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText icon:(nullable SDLArtwork *)icon secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells;
@end
NS_ASSUME_NONNULL_END
|