summaryrefslogtreecommitdiffstats
path: root/macosx/HBLanguagesSelection.m
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/HBLanguagesSelection.m')
-rw-r--r--macosx/HBLanguagesSelection.m26
1 files changed, 22 insertions, 4 deletions
diff --git a/macosx/HBLanguagesSelection.m b/macosx/HBLanguagesSelection.m
index d9d5a9b1e..65b06e862 100644
--- a/macosx/HBLanguagesSelection.m
+++ b/macosx/HBLanguagesSelection.m
@@ -36,6 +36,15 @@
return lang;
}
+- (void)setIsSelected:(BOOL)isSelected
+{
+ if (_isSelected != isSelected)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setIsSelected:_isSelected];
+ }
+ _isSelected = isSelected;
+}
+
- (NSString *)description
{
return self.language;
@@ -47,17 +56,17 @@
- (instancetype)init
{
- self = [self initWithLanguages:nil];
+ self = [self initWithLanguages:@[]];
return self;
}
-- (instancetype)initWithLanguages:(NSArray *)languages
+- (instancetype)initWithLanguages:(NSArray<NSString *> *)languages
{
self = [super init];
if (self)
{
- NSMutableArray *internal = [[NSMutableArray alloc] init];
- NSMutableArray *selected = [[NSMutableArray alloc] init];
+ NSMutableArray<HBLang *> *internal = [[NSMutableArray alloc] init];
+ NSMutableArray<HBLang *> *selected = [[NSMutableArray alloc] init];
const iso639_lang_t *lang = lang_get_next(NULL);
for (lang = lang_get_next(lang); lang != NULL; lang = lang_get_next(lang))
@@ -116,6 +125,15 @@
return [selected copy];
}
+- (void)setUndo:(NSUndoManager *)undo
+{
+ _undo = undo;
+ for (HBLang *lang in self.languagesArray)
+ {
+ lang.undo = undo;
+ }
+}
+
@end