<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -27,6 +27,7 @@
 @import &quot;CPBezierPath.j&quot;
 @import &quot;CPButton.j&quot;
 @import &quot;CPButtonBar.j&quot;
+@import &quot;CPCheckBox.j&quot;
 @import &quot;CPCib.j&quot;
 @import &quot;CPCibLoading.j&quot;
 @import &quot;CPClipView.j&quot;
@@ -53,6 +54,7 @@
 @import &quot;CPPasteboard.j&quot;
 @import &quot;CPPopUpButton.j&quot;
 @import &quot;CPProgressIndicator.j&quot;
+@import &quot;CPRadio.j&quot;
 @import &quot;CPResponder.j&quot;
 @import &quot;CPScrollView.j&quot;
 @import &quot;CPScroller.j&quot;</diff>
      <filename>AppKit/AppKit.j</filename>
    </modified>
    <modified>
      <diff>@@ -24,79 +24,123 @@
  */
 
 @import &lt;AppKit/CPButton.j&gt;
+@import &lt;AppKit/CPCheckBox.j&gt;
+@import &lt;AppKit/CPRadio.j&gt;
 
 @import &quot;NSCell.j&quot;
 @import &quot;NSControl.j&quot;
 
+
 var _CPButtonBezelStyleHeights = {};
 _CPButtonBezelStyleHeights[CPRoundedBezelStyle] = 18;
 _CPButtonBezelStyleHeights[CPTexturedRoundedBezelStyle] = 20;
 _CPButtonBezelStyleHeights[CPHUDBezelStyle] = 20;
 
+@implementation CPRadio (NSCoding)
+
+- (id)NS_initWithCoder:(CPCoder)aCoder
+{
+    self = [super NS_initWithCoder:aCoder];
+
+    if (self)
+        _radioGroup = [CPRadioGroup new];
+
+    return self;
+}
+
+@end
+
 @implementation CPButton (NSCoding)
 
 - (id)NS_initWithCoder:(CPCoder)aCoder
 {
+    if (![self isKindOfClass:[CPRadio class]] &amp;&amp; ![self isKindOfClass:[CPCheckBox class]])
+    {
+        // We need to do a bit of magic to determine if this is a checkbox or radio button.
+        var cell = [aCoder decodeObjectForKey:@&quot;NSCell&quot;],
+            alternateImage = [cell alternateImage];
+
+        if ([alternateImage isKindOfClass:[NSButtonImageSource class]])
+        {
+            if ([alternateImage imageName] === @&quot;NSSwitch&quot;)
+            {
+                CPLog.warn(&quot;Detected check box, switching to CPCheckBox&quot;);
+
+                return [[CPCheckBox alloc] NS_initWithCoder:aCoder];
+            }
+            else if ([alternateImage imageName] === @&quot;NSRadioButton&quot;)
+            {
+                CPLog.warn(&quot;Detected radio, switching to CPRadio&quot;);
+
+                return [[CPRadio alloc] NS_initWithCoder:aCoder];
+            }
+        }
+    }
+
     self = [super NS_initWithCoder:aCoder];
-    
+
     if (self)
     {
-        _controlSize = CPRegularControlSize;
-    
         var cell = [aCoder decodeObjectForKey:@&quot;NSCell&quot;];
 
-        _title = [cell title];
+        _controlSize = CPRegularControlSize;
 
-        [self setBordered:[cell isBordered]];
+        _title = [cell title];
 
-        _bezelStyle = [cell bezelStyle];
-        
-        // clean up:
-        
-        switch (_bezelStyle)
+        if (![self isKindOfClass:[CPCheckBox class]] &amp;&amp; ![self isKindOfClass:[CPRadio class]])
         {
-            // implemented:
-            case CPRoundedBezelStyle:
-            case CPTexturedRoundedBezelStyle:
-            case CPHUDBezelStyle:
-                break;
-            // approximations:
-            case CPRoundRectBezelStyle:
-                _bezelStyle = CPRoundedBezelStyle;
-                break;
-            case CPSmallSquareBezelStyle:
-            case CPThickSquareBezelStyle:
-            case CPThickerSquareBezelStyle:
-            case CPRegularSquareBezelStyle:
-            case CPTexturedSquareBezelStyle:
-            case CPShadowlessSquareBezelStyle:
-                _bezelStyle = CPTexturedRoundedBezelStyle;
-                break;
-            case CPRecessedBezelStyle:
-                _bezelStyle = CPHUDBezelStyle;
-                break;
-            // unsupported
-            case CPRoundedDisclosureBezelStyle:
-            case CPHelpButtonBezelStyle:
-            case CPCircularBezelStyle:
-            case CPDisclosureBezelStyle:
-                CPLog.warn(&quot;Unsupported bezel style: &quot; + _bezelStyle);
-                _bezelStyle = CPHUDBezelStyle;
-                break;
-            // error:
-            default:
-                CPLog.error(&quot;Unknown bezel style: &quot; + _bezelStyle);
-                _bezelStyle = CPHUDBezelStyle;
-        }
-        
-        //if (_CPButtonBezelStyleHeights[_bezelStyle] != undefined)
-        {
-            //CPLog.warn(&quot;Adjusting CPButton height from &quot; +_frame.size.height+ &quot; / &quot; + _bounds.size.height+&quot; to &quot; + _CPButtonBezelStyleHeights[_bezelStyle]);
-            _frame.size.height = 24.0;//_CPButtonBezelStyleHeights[_bezelStyle];
-            _bounds.size.height = 24.0;//_CPButtonBezelStyleHeights[_bezelStyle];
+            [self setBordered:[cell isBordered]];
+
+            _bezelStyle = [cell bezelStyle];
+
+            // clean up:
+            switch (_bezelStyle)
+            {
+                // implemented:
+                case CPRoundedBezelStyle:
+                case CPTexturedRoundedBezelStyle:
+                case CPHUDBezelStyle:
+                    break;
+                // approximations:
+                case CPRoundRectBezelStyle:
+                    _bezelStyle = CPRoundedBezelStyle;
+                    break;
+                case CPSmallSquareBezelStyle:
+                case CPThickSquareBezelStyle:
+                case CPThickerSquareBezelStyle:
+                case CPRegularSquareBezelStyle:
+                case CPTexturedSquareBezelStyle:
+                case CPShadowlessSquareBezelStyle:
+                    _bezelStyle = CPTexturedRoundedBezelStyle;
+                    break;
+                case CPRecessedBezelStyle:
+                    _bezelStyle = CPHUDBezelStyle;
+                    break;
+                // unsupported
+                case CPRoundedDisclosureBezelStyle:
+                case CPHelpButtonBezelStyle:
+                case CPCircularBezelStyle:
+                case CPDisclosureBezelStyle:
+                    CPLog.warn(&quot;Unsupported bezel style: &quot; + _bezelStyle);
+                    _bezelStyle = CPHUDBezelStyle;
+                    break;
+                // error:
+                default:
+                    CPLog.error(&quot;Unknown bezel style: &quot; + _bezelStyle);
+                    _bezelStyle = CPHUDBezelStyle;
+            }
+
+            //if (_CPButtonBezelStyleHeights[_bezelStyle] != undefined)
+            {
+                //CPLog.warn(&quot;Adjusting CPButton height from &quot; +_frame.size.height+ &quot; / &quot; + _bounds.size.height+&quot; to &quot; + _CPButtonBezelStyleHeights[_bezelStyle]);
+                _frame.size.height = 24.0;//_CPButtonBezelStyleHeights[_bezelStyle];
+                _bounds.size.height = 24.0;//_CPButtonBezelStyleHeights[_bezelStyle];
+            }
         }
+        else
+            [self setBordered:YES];
     }
-    
+
     return self;
 }
 
@@ -122,26 +166,46 @@ _CPButtonBezelStyleHeights[CPHUDBezelStyle] = 20;
 {
     BOOL        _isBordered     @accessors(readonly, getter=isBordered);
     int         _bezelStyle     @accessors(readonly, getter=bezelStyle);
-    
+
     CPString    _title          @accessors(readonly, getter=title);
+    CPImage     _alternateImage @accessors(readonly, getter=alternateImage);
 }
 
 - (id)initWithCoder:(CPCoder)aCoder
 {
     self = [super initWithCoder:aCoder];
-    
+
     if (self)
-    {   
+    {
         var buttonFlags = [aCoder decodeIntForKey:@&quot;NSButtonFlags&quot;],
             buttonFlags2 = [aCoder decodeIntForKey:@&quot;NSButtonFlags2&quot;];
-        
+
         _isBordered = (buttonFlags &amp; 0x00800000) ? YES : NO;
         _bezelStyle = (buttonFlags2 &amp; 0x7) | ((buttonFlags2 &amp; 0x20) &gt;&gt; 2);
-        
+
         // NSContents for NSButton is actually the title
         _title = [aCoder decodeObjectForKey:@&quot;NSContents&quot;];
+
+        _alternateImage = [aCoder decodeObjectForKey:@&quot;NSAlternateImage&quot;];
     }
-    
+
+    return self;
+}
+
+@end
+
+@implementation NSButtonImageSource : CPObject
+{
+    CPString    _imageName @accessors(readonly, getter=imageName);
+}
+
+- (id)initWithCoder:(CPCoder)aCoder
+{
+    self = [super init];
+
+    if (self)
+        _imageName = [aCoder decodeObjectForKey:@&quot;NSImageName&quot;];
+
     return self;
 }
 </diff>
      <filename>Tools/nib2cib/NSButton.j</filename>
    </modified>
    <modified>
      <diff>@@ -91,7 +91,7 @@ NSImageScalingToCPImageScaling[NSImageScaleProportionallyUpOrDown]  = CPScalePro
 @implementation NSImageCell : NSCell
 {
     BOOL                _animates       @accessors; 
-    NSImageAlignmenr    _imageAlignment @accessors;
+    NSImageAlignment    _imageAlignment @accessors;
     NSImageScaling      _imageScaling   @accessors(readonly, getter=imageScaling);
     NSImageFrameStyle   _frameStyle     @accessors;
 }</diff>
      <filename>Tools/nib2cib/NSImageView.j</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>269b61d6c43e2804f50c75f8fda10c4726ff20fa</id>
    </parent>
  </parents>
  <author>
    <name>Francisco Tolmasky</name>
    <email>francisco@280north.com</email>
  </author>
  <url>http://github.com/280north/cappuccino/commit/28da8ccacf101cacc32547c260bdbdccee717a6b</url>
  <id>28da8ccacf101cacc32547c260bdbdccee717a6b</id>
  <committed-date>2009-05-17T18:46:28-07:00</committed-date>
  <authored-date>2009-05-17T18:46:28-07:00</authored-date>
  <message>Prelminary support for radio buttons and checkboxes in nib2cib.

Reviewed by me.</message>
  <tree>10f22b7c5b6f490ffc11024aa5a2daa2b68a2365</tree>
  <committer>
    <name>Francisco Tolmasky</name>
    <email>francisco@280north.com</email>
  </committer>
</commit>
