PageRenderTime 32ms CodeModel.GetById 25ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/Tools/nib2cib/NSMenuItem.j

http://github.com/cacaodev/cappuccino
Unknown | 112 lines | 83 code | 29 blank | 0 comment | 0 complexity | f84d427130429e99a607d304d3af325c MD5 | raw file
  1/*
  2 * NSMenuItem.j
  3 * nib2cib
  4 *
  5 * Created by Thomas Robinson.
  6 * Copyright 2008, 280 North, Inc.
  7 *
  8 * This library is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU Lesser General Public
 10 * License as published by the Free Software Foundation; either
 11 * version 2.1 of the License, or (at your option) any later version.
 12 *
 13 * This library is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 16 * Lesser General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU Lesser General Public
 19 * License along with this library; if not, write to the Free Software
 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 21 */
 22
 23@import <AppKit/CPMenuItem.j>
 24
 25@import "NSButton.j"
 26@import "NSEvent.j"
 27@import "NSMenu.j"
 28
 29@implementation CPMenuItem (NSCoding)
 30
 31- (id)NS_initWithCoder:(CPCoder)aCoder
 32{
 33    self = [super init];
 34
 35    if (self)
 36    {
 37        _isSeparator = [aCoder decodeBoolForKey:@"NSIsSeparator"];
 38
 39        _title = [aCoder decodeObjectForKey:"NSTitle"];
 40
 41//      _font = [aCoder decodeObjectForKey:"NSTitle"];
 42
 43        _target = [aCoder decodeObjectForKey:"NSTarget"];
 44        _action = [aCoder decodeObjectForKey:"NSAction"];
 45
 46        _isEnabled = ![aCoder decodeBoolForKey:"NSIsDisabled"];
 47        _isHidden = [aCoder decodeBoolForKey:"NSIsHidden"];
 48
 49        _tag = [aCoder decodeIntForKey:"NSTag"];
 50        _state = [aCoder decodeIntForKey:"NSState"];
 51
 52         _image = [aCoder decodeObjectForKey:"NSImage"];
 53     // _alternateImage = [aCoder decodeObjectForKey:""];
 54//      _onStateImage = [aCoder decodeObjectForKey:"NSOnImage"];
 55//      _offStateImage = [aCoder decodeObjectForKey:"NSOffImage"];
 56//      _mixedStateImage = [aCoder decodeObjectForKey:"NSMixedImage"];
 57
 58        _submenu = [aCoder decodeObjectForKey:"NSSubmenu"];
 59        _menu = [aCoder decodeObjectForKey:"NSMenu"];
 60
 61        _keyEquivalent = [aCoder decodeObjectForKey:"NSKeyEquiv"];
 62        _keyEquivalentModifierMask = CP_NSMapKeyMask([aCoder decodeObjectForKey:"NSKeyEquivModMask"]);
 63
 64//      _mnemonicLocation = [aCoder decodeObjectForKey:"NSMnemonicLoc"];
 65
 66//      _isAlternate = [aCoder decodeBoolForKey:"NSIsAlternate"];
 67        _indentationLevel = [aCoder decodeIntForKey:"NSIndent"];
 68
 69//      _toolTip;
 70
 71        _representedObject = [aCoder decodeObjectForKey:"NSRepObject"];
 72    }
 73
 74    return self;
 75}
 76
 77- (void)swapCellsForParents:(JSObject)parentsForCellUIDs
 78{
 79    var target = [self target];
 80
 81    if (!target)
 82        return;
 83
 84    var parent = parentsForCellUIDs[[[self target] UID]];
 85
 86    if (parent)
 87        [self setTarget:parent];
 88}
 89
 90@end
 91
 92@implementation NSMenuItem : CPMenuItem
 93{
 94}
 95
 96- (id)initWithCoder:(CPCoder)aCoder
 97{
 98    return [self NS_initWithCoder:aCoder];
 99}
100
101- (Class)classForKeyedArchiver
102{
103    return [CPMenuItem class];
104}
105
106@end
107
108@implementation NSMenuItemCell : NSButtonCell
109{
110}
111
112@end