Permalink
Browse files

Merge pull request #5 from markcarver/master

New checkbox control!
  • Loading branch information...
2 parents 537e3a6 + 96a8dea commit e65f71968c41300e2e62d864a85fee64a3a88815 @mstratman committed Sep 21, 2011
View
12 CocoaDialog.xcodeproj/project.pbxproj
@@ -80,6 +80,9 @@
A7255376142538DC004A7B4F /* Progressbar.xib in Resources */ = {isa = PBXBuildFile; fileRef = A725536F142538DC004A7B4F /* Progressbar.xib */; };
A7255377142538DC004A7B4F /* SecureInputbox.xib in Resources */ = {isa = PBXBuildFile; fileRef = A7255370142538DC004A7B4F /* SecureInputbox.xib */; };
A7255378142538DC004A7B4F /* Textbox.xib in Resources */ = {isa = PBXBuildFile; fileRef = A7255371142538DC004A7B4F /* Textbox.xib */; };
+ A786B44A142989D500917E4D /* CDCheckboxControl.h in Headers */ = {isa = PBXBuildFile; fileRef = A786B448142989D500917E4D /* CDCheckboxControl.h */; };
+ A786B44B142989D500917E4D /* CDCheckboxControl.m in Sources */ = {isa = PBXBuildFile; fileRef = A786B449142989D500917E4D /* CDCheckboxControl.m */; };
+ A786B44E14298C6000917E4D /* Checkbox.xib in Resources */ = {isa = PBXBuildFile; fileRef = A786B44D14298C6000917E4D /* Checkbox.xib */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -160,6 +163,9 @@
A725536F142538DC004A7B4F /* Progressbar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Progressbar.xib; path = Resources/Progressbar.xib; sourceTree = "<group>"; };
A7255370142538DC004A7B4F /* SecureInputbox.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SecureInputbox.xib; path = Resources/SecureInputbox.xib; sourceTree = "<group>"; };
A7255371142538DC004A7B4F /* Textbox.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Textbox.xib; path = Resources/Textbox.xib; sourceTree = "<group>"; };
+ A786B448142989D500917E4D /* CDCheckboxControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDCheckboxControl.h; path = src/CDControl/CDThreeButtonControl/CDCheckboxControl.h; sourceTree = "<group>"; };
+ A786B449142989D500917E4D /* CDCheckboxControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDCheckboxControl.m; path = src/CDControl/CDThreeButtonControl/CDCheckboxControl.m; sourceTree = "<group>"; };
+ A786B44D14298C6000917E4D /* Checkbox.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Checkbox.xib; path = Resources/Checkbox.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -267,6 +273,7 @@
0E71D9D30963B12800FF6F7C /* CDMsgboxControl.h */,
0E71D9D40963B12800FF6F7C /* CDOkMsgboxControl.h */,
0E71D9D60963B12800FF6F7C /* CDPopUpButtonControl.h */,
+ A786B448142989D500917E4D /* CDCheckboxControl.h */,
0E71D9D80963B12800FF6F7C /* CDStandardInputboxControl.h */,
0E71D9D90963B12800FF6F7C /* CDStandardPopUpButtonControl.h */,
0E71D9DA0963B12800FF6F7C /* CDTextboxControl.h */,
@@ -292,6 +299,7 @@
isa = PBXGroup;
children = (
0E71D9EE0963B15300FF6F7C /* CDInputboxControl.m */,
+ A786B449142989D500917E4D /* CDCheckboxControl.m */,
0E71D9EF0963B15300FF6F7C /* CDMsgboxControl.m */,
0E71D9F00963B15300FF6F7C /* CDOkMsgboxControl.m */,
0E71D9F20963B15300FF6F7C /* CDPopUpButtonControl.m */,
@@ -365,6 +373,7 @@
A725536F142538DC004A7B4F /* Progressbar.xib */,
A7255370142538DC004A7B4F /* SecureInputbox.xib */,
A7255371142538DC004A7B4F /* Textbox.xib */,
+ A786B44D14298C6000917E4D /* Checkbox.xib */,
);
name = Resources;
sourceTree = "<group>";
@@ -407,6 +416,7 @@
0EC9B67E09B126D500956684 /* CDFileDialogControl.h in Headers */,
0EC9B68209B1273100956684 /* CDFileSaveControl.h in Headers */,
89BE1CA214270EC80030D0FF /* CDProgressbarInputHandler.h in Headers */,
+ A786B44A142989D500917E4D /* CDCheckboxControl.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -490,6 +500,7 @@
A7255376142538DC004A7B4F /* Progressbar.xib in Resources */,
A7255377142538DC004A7B4F /* SecureInputbox.xib in Resources */,
A7255378142538DC004A7B4F /* Textbox.xib in Resources */,
+ A786B44E14298C6000917E4D /* Checkbox.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -522,6 +533,7 @@
0EC9B67F09B126D500956684 /* CDFileDialogControl.m in Sources */,
0EC9B68409B1274100956684 /* CDFileSaveControl.m in Sources */,
89BE1C9F14270A540030D0FF /* CDProgressbarInputHandler.m in Sources */,
+ A786B44B142989D500917E4D /* CDCheckboxControl.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
592 Resources/Checkbox.xib
@@ -0,0 +1,592 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">1060</int>
+ <string key="IBDocument.SystemVersion">11B26</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1934</string>
+ <string key="IBDocument.AppKitVersion">1138</string>
+ <string key="IBDocument.HIToolboxVersion">566.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="NS.object.0">1934</string>
+ </object>
+ <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSTextField</string>
+ <string>NSView</string>
+ <string>NSWindowTemplate</string>
+ <string>NSCustomObject</string>
+ <string>NSCustomView</string>
+ <string>NSButtonCell</string>
+ <string>NSButton</string>
+ <string>NSTextFieldCell</string>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSCustomObject" id="1001">
+ <string key="NSClassName">CDCheckboxControl</string>
+ </object>
+ <object class="NSCustomObject" id="1003">
+ <string key="NSClassName">FirstResponder</string>
+ </object>
+ <object class="NSCustomObject" id="1004">
+ <string key="NSClassName">NSApplication</string>
+ </object>
+ <object class="NSWindowTemplate" id="365987548">
+ <int key="NSWindowStyleMask">1</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{272, 172}, {428, 134}}</string>
+ <int key="NSWTFlags">1685586944</int>
+ <string key="NSWindowTitle">Panel</string>
+ <string key="NSWindowClass">NSPanel</string>
+ <nil key="NSViewClass"/>
+ <nil key="NSUserInterfaceItemIdentifier"/>
+ <object class="NSView" key="NSWindowView" id="651731071">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="840052715">
+ <reference key="NSNextResponder" ref="651731071"/>
+ <int key="NSvFlags">289</int>
+ <string key="NSFrame">{{336, 12}, {78, 32}}</string>
+ <reference key="NSSuperview" ref="651731071"/>
+ <reference key="NSWindow"/>
+ <int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="704062656">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">1</string>
+ <object class="NSFont" key="NSSupport" id="838818846">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">13</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <reference key="NSControlView" ref="840052715"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="838818846"/>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="297909641">
+ <reference key="NSNextResponder" ref="651731071"/>
+ <int key="NSvFlags">289</int>
+ <string key="NSFrame">{{258, 12}, {78, 32}}</string>
+ <reference key="NSSuperview" ref="651731071"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="840052715"/>
+ <int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="366165101">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">2</string>
+ <reference key="NSSupport" ref="838818846"/>
+ <reference key="NSControlView" ref="297909641"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="838818846"/>
+ <string key="NSAlternateContents"/>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="547107954">
+ <reference key="NSNextResponder" ref="651731071"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{14, 12}, {76, 32}}</string>
+ <reference key="NSSuperview" ref="651731071"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
+ <int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="282908529">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">3</string>
+ <reference key="NSSupport" ref="838818846"/>
+ <reference key="NSControlView" ref="547107954"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="838818846"/>
+ <string key="NSAlternateContents"/>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="196127081">
+ <reference key="NSNextResponder" ref="651731071"/>
+ <int key="NSvFlags">266</int>
+ <string key="NSFrame">{{17, 86}, {394, 28}}</string>
+ <reference key="NSSuperview" ref="651731071"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="547107954"/>
+ <int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="326154662">
+ <int key="NSCellFlags">69336577</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">System Font Text</string>
+ <object class="NSFont" key="NSSupport">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">11</double>
+ <int key="NSfFlags">3100</int>
+ </object>
+ <reference key="NSControlView" ref="196127081"/>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlTextColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="NSCustomView" id="316184613">
+ <reference key="NSNextResponder" ref="651731071"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrame">{{20, 60}, {388, 18}}</string>
+ <reference key="NSSuperview" ref="651731071"/>
+ <reference key="NSWindow"/>
+ <string key="NSReuseIdentifierKey">_NS:1192</string>
+ <string key="NSClassName">NSView</string>
+ </object>
+ </object>
+ <string key="NSFrameSize">{428, 134}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="196127081"/>
+ <int key="NSViewLayerContentsRedrawPolicy">2</int>
+ <string key="NSReuseIdentifierKey">_NS:207</string>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
+ <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
+ <bool key="NSWindowIsRestorable">YES</bool>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">expandingLabel</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="196127081"/>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">button3</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="547107954"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">button2</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="297909641"/>
+ </object>
+ <int key="connectionID">19</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">button1</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="840052715"/>
+ </object>
+ <int key="connectionID">20</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">panel</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="365987548"/>
+ </object>
+ <int key="connectionID">21</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">button1Pressed:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="840052715"/>
+ </object>
+ <int key="connectionID">22</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">button2Pressed:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="297909641"/>
+ </object>
+ <int key="connectionID">23</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">button3Pressed:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="547107954"/>
+ </object>
+ <int key="connectionID">24</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">controlView</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="316184613"/>
+ </object>
+ <int key="connectionID">30</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <object class="NSArray" key="object" id="1002">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="1001"/>
+ <reference key="parent" ref="1002"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="1003"/>
+ <reference key="parent" ref="1002"/>
+ <string key="objectName">First Responder</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-3</int>
+ <reference key="object" ref="1004"/>
+ <reference key="parent" ref="1002"/>
+ <string key="objectName">Application</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="365987548"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="651731071"/>
+ </object>
+ <reference key="parent" ref="1002"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">4</int>
+ <reference key="object" ref="651731071"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="196127081"/>
+ <reference ref="840052715"/>
+ <reference ref="297909641"/>
+ <reference ref="547107954"/>
+ <reference ref="316184613"/>
+ </object>
+ <reference key="parent" ref="365987548"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="840052715"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="704062656"/>
+ </object>
+ <reference key="parent" ref="651731071"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="297909641"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="366165101"/>
+ </object>
+ <reference key="parent" ref="651731071"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">7</int>
+ <reference key="object" ref="547107954"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="282908529"/>
+ </object>
+ <reference key="parent" ref="651731071"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="196127081"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="326154662"/>
+ </object>
+ <reference key="parent" ref="651731071"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">10</int>
+ <reference key="object" ref="326154662"/>
+ <reference key="parent" ref="196127081"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">12</int>
+ <reference key="object" ref="282908529"/>
+ <reference key="parent" ref="547107954"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">13</int>
+ <reference key="object" ref="366165101"/>
+ <reference key="parent" ref="297909641"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">14</int>
+ <reference key="object" ref="704062656"/>
+ <reference key="parent" ref="840052715"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">29</int>
+ <reference key="object" ref="316184613"/>
+ <reference key="parent" ref="651731071"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.IBPluginDependency</string>
+ <string>-2.IBPluginDependency</string>
+ <string>-3.IBPluginDependency</string>
+ <string>10.IBPluginDependency</string>
+ <string>12.IBPluginDependency</string>
+ <string>13.IBPluginDependency</string>
+ <string>14.IBPluginDependency</string>
+ <string>29.IBPluginDependency</string>
+ <string>3.IBPluginDependency</string>
+ <string>3.NSWindowTemplate.visibleAtLaunch</string>
+ <string>4.IBPluginDependency</string>
+ <string>5.IBPluginDependency</string>
+ <string>6.IBPluginDependency</string>
+ <string>7.IBPluginDependency</string>
+ <string>9.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <boolean value="NO"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="1002"/>
+ <reference key="dict.values" ref="1002"/>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="1002"/>
+ <reference key="dict.values" ref="1002"/>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">32</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">CDCheckboxControl</string>
+ <string key="superclassName">CDThreeButtonControl</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">controlView</string>
+ <string key="NS.object.0">NSView</string>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">controlView</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">controlView</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/CDCheckboxControl.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">CDControl</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/CDControl.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">CDThreeButtonControl</string>
+ <string key="superclassName">CDControl</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>button1Pressed:</string>
+ <string>button2Pressed:</string>
+ <string>button3Pressed:</string>
+ <string>timeout:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>button1Pressed:</string>
+ <string>button2Pressed:</string>
+ <string>button3Pressed:</string>
+ <string>timeout:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBActionInfo">
+ <string key="name">button1Pressed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">button2Pressed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">button3Pressed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">timeout:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>button1</string>
+ <string>button2</string>
+ <string>button3</string>
+ <string>expandingLabel</string>
+ <string>panel</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSTextField</string>
+ <string>NSPanel</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>button1</string>
+ <string>button2</string>
+ <string>button3</string>
+ <string>expandingLabel</string>
+ <string>panel</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBToOneOutletInfo">
+ <string key="name">button1</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">button2</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">button3</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">expandingLabel</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">panel</string>
+ <string key="candidateClassName">NSPanel</string>
+ </object>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/CDThreeButtonControl.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
+ <real value="1060" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
+ <integer value="3000" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ </data>
+</archive>
View
18 Resources/Inputbox.xib
@@ -39,7 +39,7 @@
<object class="NSWindowTemplate" id="434343453">
<int key="NSWindowStyleMask">1</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{66, 578}, {428, 128}}</string>
+ <string key="NSWindowRect">{{66, 578}, {428, 127}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">Panel</string>
<string key="NSWindowClass">NSPanel</string>
@@ -129,7 +129,7 @@
<object class="NSTextField" id="916616914">
<reference key="NSNextResponder" ref="337231257"/>
<int key="NSvFlags">290</int>
- <string key="NSFrame">{{20, 60}, {388, 22}}</string>
+ <string key="NSFrame">{{20, 48}, {388, 22}}</string>
<reference key="NSSuperview" ref="337231257"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
@@ -163,15 +163,19 @@
<object class="NSTextField" id="555876163">
<reference key="NSNextResponder" ref="337231257"/>
<int key="NSvFlags">266</int>
- <string key="NSFrame">{{17, 90}, {394, 17}}</string>
+ <string key="NSFrame">{{17, 78}, {394, 28}}</string>
<reference key="NSSuperview" ref="337231257"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="936332646">
<int key="NSCellFlags">69336577</int>
<int key="NSCellFlags2">272629760</int>
<string key="NSContents">System Font Text</string>
- <reference key="NSSupport" ref="969040748"/>
+ <object class="NSFont" key="NSSupport">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">11</double>
+ <int key="NSfFlags">3100</int>
+ </object>
<reference key="NSControlView" ref="555876163"/>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
@@ -191,7 +195,7 @@
</object>
</object>
</array>
- <string key="NSFrameSize">{428, 128}</string>
+ <string key="NSFrameSize">{428, 127}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
</object>
@@ -333,11 +337,11 @@
<int key="objectID">6</int>
<reference key="object" ref="337231257"/>
<array class="NSMutableArray" key="children">
+ <reference ref="555876163"/>
+ <reference ref="916616914"/>
<reference ref="1054117712"/>
<reference ref="912097719"/>
<reference ref="636305855"/>
- <reference ref="916616914"/>
- <reference ref="555876163"/>
</array>
<reference key="parent" ref="434343453"/>
</object>
View
18 Resources/SecureInputbox.xib
@@ -39,7 +39,7 @@
<object class="NSWindowTemplate" id="35423412">
<int key="NSWindowStyleMask">1</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{66, 578}, {428, 128}}</string>
+ <string key="NSWindowRect">{{66, 578}, {428, 127}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">Panel</string>
<string key="NSWindowClass">NSPanel</string>
@@ -129,7 +129,7 @@
<object class="NSTextField" id="380305545">
<reference key="NSNextResponder" ref="729775593"/>
<int key="NSvFlags">290</int>
- <string key="NSFrame">{{20, 60}, {388, 22}}</string>
+ <string key="NSFrame">{{20, 48}, {388, 22}}</string>
<reference key="NSSuperview" ref="729775593"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
@@ -163,15 +163,19 @@
<object class="NSTextField" id="482391724">
<reference key="NSNextResponder" ref="729775593"/>
<int key="NSvFlags">266</int>
- <string key="NSFrame">{{17, 90}, {394, 17}}</string>
+ <string key="NSFrame">{{17, 78}, {394, 28}}</string>
<reference key="NSSuperview" ref="729775593"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="555760022">
<int key="NSCellFlags">69336577</int>
<int key="NSCellFlags2">4194304</int>
<string key="NSContents">System Font Text</string>
- <reference key="NSSupport" ref="274978056"/>
+ <object class="NSFont" key="NSSupport">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">11</double>
+ <int key="NSfFlags">3100</int>
+ </object>
<reference key="NSControlView" ref="482391724"/>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
@@ -191,7 +195,7 @@
</object>
</object>
</array>
- <string key="NSFrameSize">{428, 128}</string>
+ <string key="NSFrameSize">{428, 127}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
</object>
@@ -333,11 +337,11 @@
<int key="objectID">6</int>
<reference key="object" ref="729775593"/>
<array class="NSMutableArray" key="children">
+ <reference ref="482391724"/>
+ <reference ref="380305545"/>
<reference ref="1028819938"/>
<reference ref="22176305"/>
<reference ref="548094609"/>
- <reference ref="380305545"/>
- <reference ref="482391724"/>
</array>
<reference key="parent" ref="35423412"/>
</object>
View
4 src/AppController.m
@@ -37,6 +37,8 @@
#import "CDPopUpButtonControl.h"
#import "CDStandardPopUpButtonControl.h"
+#import "CDCheckboxControl.h"
+
@implementation AppController
- (void) awakeFromNib
@@ -120,6 +122,8 @@ - (CDControl *) chooseControl:(NSString *)runMode useOptions:options addExtraOpt
return [[(CDControl *)[CDFileSelectControl alloc] initWithOptions:options] autorelease];
} else if ([runMode isEqualToString:@"filesave"]) {
return [[(CDControl *)[CDFileSaveControl alloc] initWithOptions:options] autorelease];
+ } else if ([runMode isEqualToString:@"checkbox"]) {
+ return [[(CDControl *)[CDCheckboxControl alloc] initWithOptions:options] autorelease];
} else if ([runMode isEqualToString:@"msgbox"]) {
return [[(CDControl *)[CDMsgboxControl alloc] initWithOptions:options] autorelease];
} else if ([runMode isEqualToString:@"yesno-msgbox"]) {
View
16 src/CDControl/CDFileDialogControl.m
@@ -22,22 +22,6 @@
@implementation CDFileDialogControl
-// You really need to override this. And be sure to
-// include the options below
-- (NSDictionary *) availableKeys
-{
- NSNumber *vMul = [NSNumber numberWithInt:CDOptionsMultipleValues];
- NSNumber *vOne = [NSNumber numberWithInt:CDOptionsOneValue];
- NSNumber *vNone = [NSNumber numberWithInt:CDOptionsNoValues];
-
- return [NSDictionary dictionaryWithObjectsAndKeys:
- vOne, @"text",
- vMul, @"with-extensions",
- vOne, @"with-directory",
- vOne, @"with-file",
- vNone, @"packages-as-directories",
- nil];
-}
- (NSArray *) extensionsFromOptionKey:(NSString *)key
{
View
12 src/CDControl/CDFileDialogControl/CDFileSaveControl.m
@@ -79,7 +79,17 @@ - (NSArray *) runControlFromOptions:(CDOptions *)options
[panel setContentSize:[self findNewSizeForWindow:panel]];
}
- result = [panel runModalForDirectory:dir file:file];
+ if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber10_6) {
+ result = [panel runModalForDirectory:dir file:file];
+ }
+ else {
+ if (dir != nil) {
+ NSURL * url = [[[NSURL alloc] initFileURLWithPath:dir] autorelease];
+ [panel setDirectoryURL:url];
+ }
+ [panel setNameFieldStringValue:file];
+ [panel runModal];
+ }
if (result == NSFileHandlingPanelOKButton) {
return [NSArray arrayWithObject:[panel filename]];
View
15 src/CDControl/CDFileDialogControl/CDFileSelectControl.m
@@ -92,7 +92,20 @@ - (NSArray *) runControlFromOptions:(CDOptions *)options
[panel setContentSize:[self findNewSizeForWindow:panel]];
}
- result = [panel runModalForDirectory:dir file:file types:extensions];
+
+ if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber10_6) {
+ result = [panel runModalForDirectory:dir file:file types:extensions];
+ }
+ else {
+ if (dir != nil) {
+ NSURL * url = [[[NSURL alloc] initFileURLWithPath:dir] autorelease];
+ [panel setDirectoryURL:url];
+ }
+ [panel setAllowedFileTypes:extensions];
+ [panel setNameFieldStringValue:file];
+ [panel runModal];
+ }
+
if (result == NSOKButton) {
return [panel filenames];
View
14 src/CDControl/CDThreeButtonControl.m
@@ -120,19 +120,19 @@ - (void) setButtons
// Should be called after setButtons, and before resize
- (void) setLabel:(NSString *)labelText
{
- if (labelText != nil) {
- [expandingLabel setStringValue:labelText];
- } else {
- [expandingLabel setStringValue:@""];
+ if (labelText == nil) {
+ labelText = @"";
}
+
+ [expandingLabel setStringValue:labelText];
NSRect labelRect = [expandingLabel frame];
- NSTextStorage *textStorage = [[[NSTextStorage alloc] initWithString: labelText]autorelease];
+ NSTextStorage *textStorage = [[[NSTextStorage alloc] initWithString: labelText] autorelease];
NSTextContainer *textContainer = [[[NSTextContainer alloc] initWithContainerSize:NSMakeSize(labelRect.size.width, FLT_MAX)] autorelease];
- NSLayoutManager *layoutManager = [[[NSLayoutManager alloc]init] autorelease];
+ NSLayoutManager *layoutManager = [[[NSLayoutManager alloc]init] autorelease];
[layoutManager addTextContainer: textContainer];
[textStorage addLayoutManager: layoutManager];
- [textContainer setLineFragmentPadding:0];
+ [textContainer setLineFragmentPadding:0.0];
[layoutManager glyphRangeForTextContainer:textContainer];
float newHeight = [layoutManager usedRectForTextContainer:textContainer].size.height;
View
17 src/CDControl/CDThreeButtonControl/CDCheckboxControl.h
@@ -0,0 +1,17 @@
+//
+// CDCheckboxControl.h
+// CocoaDialog
+//
+// Created by Mark Carver on 9/20/11.
+// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "CDThreeButtonControl.h"
+
+@interface CDCheckboxControl : CDThreeButtonControl {
+ IBOutlet NSView * controlView;
+ NSMutableArray * checkboxes;
+}
+
+@end
View
227 src/CDControl/CDThreeButtonControl/CDCheckboxControl.m
@@ -0,0 +1,227 @@
+//
+// CDCheckboxControl.m
+// CocoaDialog
+//
+// Created by Mark Carver on 9/20/11.
+// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import "CDCheckboxControl.h"
+
+@implementation CDCheckboxControl
+
+- (NSDictionary *) availableKeys
+{
+ NSNumber *vNone = [NSNumber numberWithInt:CDOptionsNoValues];
+ NSNumber *vOne = [NSNumber numberWithInt:CDOptionsOneValue];
+ NSNumber *vMul = [NSNumber numberWithInt:CDOptionsMultipleValues];
+
+ return [NSDictionary dictionaryWithObjectsAndKeys:
+ vOne, @"text",
+ vOne, @"button1",
+ vOne, @"button2",
+ vOne, @"button3",
+ vOne, @"cancel",
+ vNone,@"allow-mixed",
+ vMul, @"items",
+ vMul, @"checked",
+ vMul, @"mixed",
+ vMul, @"disabled",
+ vNone, @"float",
+ vOne, @"timeout",
+ nil];
+}
+
+- (NSArray *) runControlFromOptions:(CDOptions *)options
+{
+ NSString *buttonRv = nil;
+ NSString *itemRv = nil;
+ NSArray *items = [[[NSArray alloc] init] autorelease];
+ NSArray *checked = [[[NSArray alloc] init] autorelease];
+ NSArray *mixed = [[[NSArray alloc] init] autorelease];
+ NSArray *disabled = [[[NSArray alloc] init] autorelease];
+
+ [self setOptions:options];
+
+ // check that they specified at least a button1
+ // return nil if not
+ if (![options optValue:@"button1"]
+ && [self isMemberOfClass:[CDCheckboxControl class]])
+ {
+ if ([options hasOpt:@"debug"]) {
+ [CDControl debug:@"Must supply at least a --button1"];
+ }
+ return nil;
+ }
+
+ // Load Checkbox.xib or return nil
+ if (![NSBundle loadNibNamed:@"Checkbox" owner:self]) {
+ if ([options hasOpt:@"debug"]) {
+ [CDControl debug:@"Could not load Checkbox.xib"];
+ }
+ return nil;
+ }
+
+ // Setup the checkbox items
+ items = [options optValues:@"items"];
+ if ([options hasOpt:@"checked"]) {
+ checked = [options optValues:@"checked"];
+ }
+ if ([options hasOpt:@"allow-mixed"] && [options hasOpt:@"mixed"]) {
+ mixed = [options optValues:@"mixed"];
+ }
+ if ([options hasOpt:@"disabled"]) {
+ disabled = [options optValues:@"disabled"];
+ }
+ checkboxes = [[[NSMutableArray alloc] init] autorelease];
+ int count = 0;
+ if (items != nil && [items count]) {
+ NSEnumerator *en = [items objectEnumerator];
+ NSRect viewFrame = [controlView frame];
+ NSFont * checkboxFont = [expandingLabel font];
+ id obj;
+ while (obj = [en nextObject]) {
+ NSRect frame = NSMakeRect(0, 0, viewFrame.size.width, 18);
+ NSButton *checkBox = [[NSButton alloc] initWithFrame:frame];
+ [checkBox setTag: count];
+ [checkBox setFont:checkboxFont];
+ [checkBox setButtonType:NSSwitchButton];
+ [checkBox setTitle:(NSString *)obj];
+ if (checked != nil && [checked count]) {
+ if ([checked containsObject:[NSString stringWithFormat:@"%i", count]]) {
+ [checkBox setState: NSOnState];
+ }
+ }
+ if (mixed != nil && [mixed count]) {
+ if ([mixed containsObject:[NSString stringWithFormat:@"%i", count]]) {
+ [checkBox setAllowsMixedState: YES];
+ [checkBox setState: NSMixedState];
+ }
+ }
+ if (disabled != nil && [disabled count]) {
+ if ([disabled containsObject:[NSString stringWithFormat:@"%i", count]]) {
+ [checkBox setEnabled: NO];
+ }
+ }
+ [controlView addSubview:checkBox];
+ [checkboxes addObject:checkBox];
+ count++;
+ }
+ } else {
+ if ([options hasOpt:@"debug"]) {
+ [CDControl debug:@"No items provided."];
+ }
+ return nil;
+ }
+
+ [self setTitleButtonsLabel:[options optValue:@"text"]];
+
+ [self setTimeout];
+
+ [self runAndSetRv];
+
+ // set return values
+ if ([options hasOpt:@"string-output"]) {
+ if (rv == 1) {
+ buttonRv = [button1 title];
+ } else if (rv == 2) {
+ buttonRv = [button2 title];
+ } else if (rv == 3) {
+ buttonRv = [button3 title];
+ } else if (rv == 4) {
+ buttonRv = @"4";
+ } else if (rv == 0) {
+ buttonRv = @"timeout";
+ }
+ if (checkboxes != nil && [checkboxes count]) {
+ NSMutableArray *itemRvArray = [[[NSMutableArray alloc] init] autorelease];
+ NSEnumerator *en = [checkboxes objectEnumerator];
+ id obj;
+ int state;
+ while (obj = [en nextObject]) {
+ state = [obj state];
+ switch (state) {
+ case NSOffState: [itemRvArray addObject: @"off"]; break;
+ case NSOnState: [itemRvArray addObject: @"on"]; break;
+ case NSMixedState: [itemRvArray addObject: @"mixed"]; break;
+ }
+ }
+ itemRv = [itemRvArray componentsJoinedByString:@" "];
+ }
+ } else {
+ buttonRv = [NSString stringWithFormat:@"%d",rv];
+ if (checkboxes != nil && [checkboxes count]) {
+ NSMutableArray *itemRvArray = [[[NSMutableArray alloc] init] autorelease];
+ NSEnumerator *en = [checkboxes objectEnumerator];
+ id obj;
+ while (obj = [en nextObject]) {
+ [itemRvArray addObject: [NSString stringWithFormat:@"%i", [obj state]]];
+ }
+ itemRv = [itemRvArray componentsJoinedByString:@" "];
+ }
+ }
+ return [NSArray arrayWithObjects:buttonRv, itemRv, nil];
+}
+
+// Should be called after setButtons, and before resize
+- (void) setLabel:(NSString *)labelText
+{
+ if (labelText != nil) {
+ [expandingLabel setStringValue:labelText];
+ } else {
+ [expandingLabel setStringValue:@""];
+ }
+
+ NSRect labelRect = [expandingLabel frame];
+ NSTextStorage *textStorage = [[[NSTextStorage alloc] initWithString: labelText]autorelease];
+ NSTextContainer *textContainer = [[[NSTextContainer alloc] initWithContainerSize:NSMakeSize(labelRect.size.width, FLT_MAX)] autorelease];
+ NSLayoutManager *layoutManager = [[[NSLayoutManager alloc]init] autorelease];
+ [layoutManager addTextContainer: textContainer];
+ [textStorage addLayoutManager: layoutManager];
+ [textContainer setLineFragmentPadding:0];
+ [layoutManager glyphRangeForTextContainer:textContainer];
+
+ float labelNewHeight = [layoutManager usedRectForTextContainer:textContainer].size.height;
+ float labelHeightDiff = labelNewHeight - labelRect.size.height;
+
+ // Set label's new height
+ NSRect l = NSMakeRect(labelRect.origin.x, labelRect.origin.y - labelHeightDiff, labelRect.size.width, labelNewHeight);
+ [expandingLabel setFrame: l];
+
+ // Calculate the controlView height
+ NSRect controlFrame = [controlView frame];
+ float controlHeight = (float)([checkboxes count] * 18);
+
+ // Set panel's new width and height
+ NSSize p = [[panel contentView] frame].size;
+ p.height += labelHeightDiff + (controlHeight - controlFrame.size.height);
+ [panel setContentSize:p];
+ [panel center];
+
+ // Set control's new height
+ NSSize s = [controlView frame].size;
+ s.height -= labelHeightDiff;
+ [controlView setFrameSize:s];
+
+ // Align checkboxes
+ if (checkboxes != nil && [checkboxes count]) {
+ NSEnumerator *en = [checkboxes objectEnumerator];
+ float count = 0;
+ id obj;
+ while (obj = [en nextObject]) {
+ count++;
+ NSRect checkboxFrame = NSMakeRect(0, controlHeight - (count * 18.0), controlFrame.size.width, 18.0);
+ [obj setFrame:checkboxFrame];
+ }
+ }
+
+}
+
+
+- (void) dealloc
+{
+ [super dealloc];
+}
+
+
+@end

0 comments on commit e65f719

Please sign in to comment.