diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-07-27 17:00:45 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-07-27 17:00:45 +0000 |
commit | c9e416c3c74910d79fd548180584491b257b833b (patch) | |
tree | 98813297be9238782c7516da4e489d8da21c3b7e /AppKit/GTMUILocalizer.m | |
parent | 992bf43928c259fd791f16d8639f000195310017 (diff) |
[Author: thomasvl]
Support for NSMatrix in uistate files (dumps the cells and row/column counts).
Support for NSMatrix in GTMUILocalizer.
Added checkboxes and radio groups to the GTMUILocalizer unittest.
R=dmaclach
DELTA=551 (541 added, 0 deleted, 10 changed)
Diffstat (limited to 'AppKit/GTMUILocalizer.m')
-rw-r--r-- | AppKit/GTMUILocalizer.m | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/AppKit/GTMUILocalizer.m b/AppKit/GTMUILocalizer.m index 1782159..8f7d467 100644 --- a/AppKit/GTMUILocalizer.m +++ b/AppKit/GTMUILocalizer.m @@ -97,6 +97,8 @@ // Do the main menu NSMenu *menu = [object mainMenu]; [self localizeMenu:menu recursively:recursive]; + } else if ([object isKindOfClass:[NSCell class]]) { + [self localizeCell:(NSCell *)object recursively:recursive]; } } } @@ -215,6 +217,24 @@ [[(NSSearchField *)view cell] setPlaceholderString:localizedPlaceholer]; } } + + // Do any NSMatrix placeholders + if ([view isKindOfClass:[NSMatrix class]]) { + NSMatrix *matrix = (NSMatrix *)view; + // Process the prototype + id cell = [matrix prototype]; + [self localizeCell:cell recursively:recursive]; + // Process the cells + GTM_FOREACH_OBJECT(cell, [matrix cells]) { + [self localizeCell:cell recursively:recursive]; + // The tooltip isn't on a cell, so we do it via the matrix. + NSString *toolTip = [matrix toolTipForCell:cell]; + NSString *localizedToolTip = [self localizedStringForString:toolTip]; + if (localizedToolTip) { + [matrix setToolTip:localizedToolTip forCell:cell]; + } + } + } } - (void)localizeMenu:(NSMenu *)menu recursively:(BOOL)recursive { @@ -238,4 +258,18 @@ } } } + +- (void)localizeCell:(NSCell *)cell recursively:(BOOL)recursive { + if (cell) { + NSString *title = [cell title]; + NSString *localizedTitle = [self localizedStringForString:title]; + if (localizedTitle) { + [cell setTitle:localizedTitle]; + } + [self localizeMenu:[cell menu] recursively:recursive]; + id obj = [cell representedObject]; + [self localizeObject:obj recursively:recursive]; + } +} + @end |