Browse files

Added HUD text view and text field

  • Loading branch information...
1 parent 0a65278 commit d1bdbe9bc26cb753580cb75a4274a5864f44b310 @indragie indragie committed Jan 23, 2012
View
422 Catalog/en.lproj/MainMenu.xib
@@ -11,13 +11,20 @@
<string key="NS.object.0">1938</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
- <string>NSView</string>
- <string>NSMenu</string>
- <string>NSWindowTemplate</string>
+ <string>NSSegmentedControl</string>
+ <string>NSScroller</string>
<string>NSMenuItem</string>
+ <string>NSMenu</string>
+ <string>NSTextFieldCell</string>
+ <string>NSButtonCell</string>
+ <string>NSButton</string>
+ <string>NSScrollView</string>
<string>NSCustomObject</string>
<string>NSSegmentedCell</string>
- <string>NSSegmentedControl</string>
+ <string>NSView</string>
+ <string>NSWindowTemplate</string>
+ <string>NSTextField</string>
+ <string>NSTextView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1294,7 +1301,7 @@
<object class="NSCustomObject" id="976324537">
<string key="NSClassName">SNRHUDAppDelegate</string>
</object>
- <object class="NSWindowTemplate" id="976506926">
+ <object class="NSWindowTemplate" id="657836172">
<int key="NSWindowStyleMask">31</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{131, 159}, {290, 284}}</string>
@@ -1303,20 +1310,20 @@
<string key="NSWindowClass">SNRHUDWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
- <object class="NSView" key="NSWindowView" id="966813034">
+ <object class="NSView" key="NSWindowView" id="616882760">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
- <object class="NSSegmentedControl" id="546168056">
- <reference key="NSNextResponder" ref="966813034"/>
+ <object class="NSSegmentedControl" id="725209211">
+ <reference key="NSNextResponder" ref="616882760"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{49, 253}, {193, 24}}</string>
- <reference key="NSSuperview" ref="966813034"/>
+ <reference key="NSSuperview" ref="616882760"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
+ <reference key="NSNextKeyView" ref="244134406"/>
<string key="NSReuseIdentifierKey">_NS:2177</string>
<bool key="NSEnabled">YES</bool>
- <object class="NSSegmentedCell" key="NSCell" id="376873859">
+ <object class="NSSegmentedCell" key="NSCell" id="659173395">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<object class="NSFont" key="NSSupport">
@@ -1325,7 +1332,7 @@
<int key="NSfFlags">16</int>
</object>
<string key="NSCellIdentifier">_NS:2177</string>
- <reference key="NSControlView" ref="546168056"/>
+ <reference key="NSControlView" ref="725209211"/>
<array class="NSMutableArray" key="NSSegmentImages">
<object class="NSSegmentItem">
<double key="NSSegmentItemWidth">45</double>
@@ -1349,11 +1356,272 @@
<int key="NSSegmentStyle">1</int>
</object>
</object>
+ <object class="NSTextField" id="244134406">
+ <reference key="NSNextResponder" ref="616882760"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{20, 216}, {250, 22}}</string>
+ <reference key="NSSuperview" ref="616882760"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="370655449"/>
+ <string key="NSReuseIdentifierKey">_NS:903</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="97320464">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">text</string>
+ <object class="NSFont" key="NSSupport">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">11</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <string key="NSCellIdentifier">_NS:903</string>
+ <reference key="NSControlView" ref="244134406"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">textBackgroundColor</string>
+ <object class="NSColor" key="NSColor" id="130429822">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">textColor</string>
+ <object class="NSColor" key="NSColor" id="155222163">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="NSButton" id="887948449">
+ <reference key="NSNextResponder" ref="616882760"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{188, 20}, {82, 23}}</string>
+ <reference key="NSSuperview" ref="616882760"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
+ <string key="NSReuseIdentifierKey">_NS:2510</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="372624357">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">Cancel</string>
+ <object class="NSFont" key="NSSupport" id="278356880">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">13</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <string key="NSCellIdentifier">_NS:2510</string>
+ <reference key="NSControlView" ref="887948449"/>
+ <int key="NSButtonFlags">-2033434369</int>
+ <int key="NSButtonFlags2">134</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSButton" id="49079046">
+ <reference key="NSNextResponder" ref="616882760"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{96, 20}, {82, 23}}</string>
+ <reference key="NSSuperview" ref="616882760"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="887948449"/>
+ <string key="NSReuseIdentifierKey">_NS:2510</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="547434519">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">Done</string>
+ <reference key="NSSupport" ref="278356880"/>
+ <string key="NSCellIdentifier">_NS:2510</string>
+ <reference key="NSControlView" ref="49079046"/>
+ <int key="NSButtonFlags">-2033434369</int>
+ <int key="NSButtonFlags2">134</int>
+ <string key="NSAlternateContents"/>
+ <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSScrollView" id="370655449">
+ <reference key="NSNextResponder" ref="616882760"/>
+ <int key="NSvFlags">256</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSClipView" id="727247371">
+ <reference key="NSNextResponder" ref="370655449"/>
+ <int key="NSvFlags">2304</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSTextView" id="674277613">
+ <reference key="NSNextResponder" ref="727247371"/>
+ <int key="NSvFlags">2322</int>
+ <set class="NSMutableSet" key="NSDragTypes">
+ <string>Apple HTML pasteboard type</string>
+ <string>Apple PDF pasteboard type</string>
+ <string>Apple PICT pasteboard type</string>
+ <string>Apple PNG pasteboard type</string>
+ <string>Apple URL pasteboard type</string>
+ <string>CorePasteboardFlavorType 0x6D6F6F76</string>
+ <string>NSColor pasteboard type</string>
+ <string>NSFilenamesPboardType</string>
+ <string>NSStringPboardType</string>
+ <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
+ <string>NeXT RTFD pasteboard type</string>
+ <string>NeXT Rich Text Format v1.0 pasteboard type</string>
+ <string>NeXT TIFF v4.0 pasteboard type</string>
+ <string>NeXT font pasteboard type</string>
+ <string>NeXT ruler pasteboard type</string>
+ <string>WebURLsWithTitlesPboardType</string>
+ <string>public.url</string>
+ </set>
+ <string key="NSFrameSize">{248, 133}</string>
+ <reference key="NSSuperview" ref="727247371"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="608436794"/>
+ <string key="NSReuseIdentifierKey">_NS:1480</string>
+ <object class="NSTextContainer" key="NSTextContainer" id="1022982741">
+ <object class="NSLayoutManager" key="NSLayoutManager">
+ <object class="NSTextStorage" key="NSTextStorage">
+ <object class="NSMutableString" key="NSString">
+ <characters key="NS.bytes"/>
+ </object>
+ <nil key="NSDelegate"/>
+ </object>
+ <array class="NSMutableArray" key="NSTextContainers">
+ <reference ref="1022982741"/>
+ </array>
+ <int key="NSLMFlags">134</int>
+ <nil key="NSDelegate"/>
+ </object>
+ <reference key="NSTextView" ref="674277613"/>
+ <double key="NSWidth">248</double>
+ <int key="NSTCFlags">1</int>
+ </object>
+ <object class="NSTextViewSharedData" key="NSSharedData">
+ <int key="NSFlags">67121127</int>
+ <int key="NSTextCheckingTypes">0</int>
+ <nil key="NSMarkedAttributes"/>
+ <reference key="NSBackgroundColor" ref="130429822"/>
+ <dictionary key="NSSelectedAttributes">
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">selectedTextBackgroundColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">selectedTextColor</string>
+ <reference key="NSColor" ref="155222163"/>
+ </object>
+ </dictionary>
+ <reference key="NSInsertionColor" ref="155222163"/>
+ <dictionary key="NSLinkAttributes">
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDEAA</bytes>
+ </object>
+ <object class="NSCursor" key="NSCursor">
+ <string key="NSHotSpot">{8, -8}</string>
+ <int key="NSCursorType">13</int>
+ </object>
+ <integer value="1" key="NSUnderline"/>
+ </dictionary>
+ <nil key="NSDefaultParagraphStyle"/>
+ <nil key="NSTextFinder"/>
+ <int key="NSPreferredTextFinderStyle">1</int>
+ </object>
+ <int key="NSTVFlags">6</int>
+ <string key="NSMaxSize">{463, 10000000}</string>
+ <string key="NSMinize">{238, 133}</string>
+ <nil key="NSDelegate"/>
+ </object>
+ </array>
+ <string key="NSFrame">{{1, 1}, {248, 133}}</string>
+ <reference key="NSSuperview" ref="370655449"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="674277613"/>
+ <string key="NSReuseIdentifierKey">_NS:1478</string>
+ <reference key="NSDocView" ref="674277613"/>
+ <reference key="NSBGColor" ref="130429822"/>
+ <object class="NSCursor" key="NSCursor">
+ <string key="NSHotSpot">{4, 5}</string>
+ <object class="NSImage" key="NSImage">
+ <int key="NSImageFlags">12582912</int>
+ <array class="NSMutableArray" key="NSReps">
+ <array>
+ <integer value="0"/>
+ <object class="NSBitmapImageRep">
+ <object class="NSData" key="NSTIFFRepresentation">
+ <bytes key="NS.bytes">TU0AKgAAAHCAFUqgBVKsAAAAwdVQUqwaEQeIRGJRGFlYqwWLQ+JxuOQpVRmEx2RROKwOQyOUQSPyaUym
+SxqWyKXyeYxyZzWbSuJTScRCbz2Nz+gRKhUOfTqeUai0OSxiWTiBQSHSGFquGwekxyAgAAAOAQAAAwAA
+AAEAEAAAAQEAAwAAAAEAEAAAAQIAAwAAAAIACAAIAQMAAwAAAAEABQAAAQYAAwAAAAEAAQAAAREABAAA
+AAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEAAgAAARYAAwAAAAEAEAAAARcABAAAAAEAAABnARwAAwAA
+AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
+ </object>
+ </object>
+ </array>
+ </array>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwAA</bytes>
+ </object>
+ </object>
+ </object>
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="608436794">
+ <reference key="NSNextResponder" ref="370655449"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{234, 1}, {15, 133}}</string>
+ <reference key="NSSuperview" ref="370655449"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="49079046"/>
+ <string key="NSReuseIdentifierKey">_NS:1494</string>
+ <reference key="NSTarget" ref="370655449"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSCurValue">1</double>
+ <double key="NSPercent">0.85256409645080566</double>
+ </object>
+ <object class="NSScroller" id="931446201">
+ <reference key="NSNextResponder" ref="370655449"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{-100, -100}, {87, 18}}</string>
+ <reference key="NSSuperview" ref="370655449"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="727247371"/>
+ <string key="NSReuseIdentifierKey">_NS:1482</string>
+ <int key="NSsFlags">1</int>
+ <reference key="NSTarget" ref="370655449"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSCurValue">1</double>
+ <double key="NSPercent">0.94565218687057495</double>
+ </object>
+ </array>
+ <string key="NSFrame">{{20, 73}, {250, 135}}</string>
+ <reference key="NSSuperview" ref="616882760"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="931446201"/>
+ <string key="NSReuseIdentifierKey">_NS:940</string>
+ <int key="NSsFlags">133138</int>
+ <reference key="NSVScroller" ref="608436794"/>
+ <reference key="NSHScroller" ref="931446201"/>
+ <reference key="NSContentView" ref="727247371"/>
+ </object>
</array>
<string key="NSFrameSize">{290, 284}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="546168056"/>
+ <reference key="NSNextKeyView" ref="725209211"/>
<string key="NSReuseIdentifierKey">_NS:197</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
@@ -2042,7 +2310,7 @@
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="976324537"/>
- <reference key="destination" ref="976506926"/>
+ <reference key="destination" ref="657836172"/>
</object>
<int key="connectionID">538</int>
</object>
@@ -3034,32 +3302,100 @@
</object>
<object class="IBObjectRecord">
<int key="objectID">536</int>
- <reference key="object" ref="976506926"/>
+ <reference key="object" ref="657836172"/>
<array class="NSMutableArray" key="children">
- <reference ref="966813034"/>
+ <reference ref="616882760"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">537</int>
- <reference key="object" ref="966813034"/>
+ <reference key="object" ref="616882760"/>
<array class="NSMutableArray" key="children">
- <reference ref="546168056"/>
+ <reference ref="725209211"/>
+ <reference ref="244134406"/>
+ <reference ref="887948449"/>
+ <reference ref="49079046"/>
+ <reference ref="370655449"/>
</array>
- <reference key="parent" ref="976506926"/>
+ <reference key="parent" ref="657836172"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">539</int>
- <reference key="object" ref="546168056"/>
+ <reference key="object" ref="725209211"/>
<array class="NSMutableArray" key="children">
- <reference ref="376873859"/>
+ <reference ref="659173395"/>
</array>
- <reference key="parent" ref="966813034"/>
+ <reference key="parent" ref="616882760"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">540</int>
- <reference key="object" ref="376873859"/>
- <reference key="parent" ref="546168056"/>
+ <reference key="object" ref="659173395"/>
+ <reference key="parent" ref="725209211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">541</int>
+ <reference key="object" ref="244134406"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="97320464"/>
+ </array>
+ <reference key="parent" ref="616882760"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">542</int>
+ <reference key="object" ref="97320464"/>
+ <reference key="parent" ref="244134406"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">545</int>
+ <reference key="object" ref="887948449"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="372624357"/>
+ </array>
+ <reference key="parent" ref="616882760"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">546</int>
+ <reference key="object" ref="372624357"/>
+ <reference key="parent" ref="887948449"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">547</int>
+ <reference key="object" ref="49079046"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="547434519"/>
+ </array>
+ <reference key="parent" ref="616882760"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">548</int>
+ <reference key="object" ref="547434519"/>
+ <reference key="parent" ref="49079046"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">551</int>
+ <reference key="object" ref="370655449"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="674277613"/>
+ <reference ref="931446201"/>
+ <reference ref="608436794"/>
+ </array>
+ <reference key="parent" ref="616882760"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">552</int>
+ <reference key="object" ref="674277613"/>
+ <reference key="parent" ref="370655449"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">553</int>
+ <reference key="object" ref="931446201"/>
+ <reference key="parent" ref="370655449"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">554</int>
+ <reference key="object" ref="608436794"/>
+ <reference key="parent" ref="370655449"/>
</object>
</array>
</object>
@@ -3208,6 +3544,20 @@
<string key="540.CustomClassName">SNRHUDSegmentedCell</string>
<integer value="2" key="540.IBNSSegmentedControlInspectorSelectedSegmentMetadataKey"/>
<string key="540.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="541.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="542.CustomClassName">SNRHUDTextFieldCell</string>
+ <string key="542.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="545.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="546.CustomClassName">SNRHUDButtonCell</string>
+ <string key="546.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="547.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="548.CustomClassName">SNRHUDButtonCell</string>
+ <string key="548.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="551.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="552.CustomClassName">SNRHUDTextView</string>
+ <string key="552.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="553.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="554.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="57.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3227,7 +3577,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">540</int>
+ <int key="maxID">554</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3292,6 +3642,14 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">SNRHUDButtonCell</string>
+ <string key="superclassName">NSButtonCell</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/SNRHUDButtonCell.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">SNRHUDSegmentedCell</string>
<string key="superclassName">NSSegmentedCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -3300,11 +3658,19 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">SNRHUDSegmentedControl</string>
- <string key="superclassName">NSSegmentedControl</string>
+ <string key="className">SNRHUDTextFieldCell</string>
+ <string key="superclassName">NSTextFieldCell</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/SNRHUDTextFieldCell.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">SNRHUDTextView</string>
+ <string key="superclassName">NSTextView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/SNRHUDSegmentedControl.h</string>
+ <string key="minorKey">./Classes/SNRHUDTextView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
View
5 README.md
@@ -11,7 +11,10 @@ As of Xcode 4, IBPlugins are no longer supported. Therefore, you will need to ei
`SNRHUDKit` is nowhere near complete at this time. The only controls/elements that have been at least partially implemented are:
* Window (`SNRHUDWindow`)
-* Segmented control (`SNRHUDSegmentedControl`)
+* Segmented control (`SNRHUDSegmentedCell`)
+* Text view (`SNRHUDTextView`)
+* Basic rounded button (`SNRHUDButtonCell`)
+* Text field (`SNRHUDTextFieldCell`)
Here's a mockup of what the complete set of elements will look like:
View
56 SNRHUDKit.xcodeproj/project.pbxproj
@@ -9,8 +9,8 @@
/* Begin PBXBuildFile section */
0392858114CCCBF300D02672 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0392858014CCCBF300D02672 /* Cocoa.framework */; };
0392858B14CCCBF300D02672 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0392858914CCCBF300D02672 /* InfoPlist.strings */; };
- 0392859714CCCC4B00D02672 /* SNRHUDSegmentedControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0392859514CCCC4B00D02672 /* SNRHUDSegmentedControl.h */; };
- 0392859814CCCC4B00D02672 /* SNRHUDSegmentedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 0392859614CCCC4B00D02672 /* SNRHUDSegmentedControl.m */; };
+ 0392859714CCCC4B00D02672 /* SNRHUDSegmentedCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 0392859514CCCC4B00D02672 /* SNRHUDSegmentedCell.h */; };
+ 0392859814CCCC4B00D02672 /* SNRHUDSegmentedCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0392859614CCCC4B00D02672 /* SNRHUDSegmentedCell.m */; };
039285B014CCD40500D02672 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0392858014CCCBF300D02672 /* Cocoa.framework */; };
039285B614CCD40500D02672 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 039285B414CCD40500D02672 /* InfoPlist.strings */; };
039285B814CCD40500D02672 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 039285B714CCD40500D02672 /* main.m */; };
@@ -23,6 +23,16 @@
039285CF14CCE82700D02672 /* NSBezierPath+MCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 039285CD14CCE82700D02672 /* NSBezierPath+MCAdditions.m */; };
039285D214CCF39B00D02672 /* SNRHUDWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 039285D014CCF39B00D02672 /* SNRHUDWindow.h */; };
039285D314CCF39B00D02672 /* SNRHUDWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 039285D114CCF39B00D02672 /* SNRHUDWindow.m */; };
+ 039285D614CDE58800D02672 /* SNRHUDTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 039285D414CDE58700D02672 /* SNRHUDTextFieldCell.h */; };
+ 039285D714CDE58800D02672 /* SNRHUDTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 039285D514CDE58800D02672 /* SNRHUDTextFieldCell.m */; };
+ 039285E514CE007100D02672 /* SNRHUDButtonCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 039285E314CE007100D02672 /* SNRHUDButtonCell.h */; };
+ 039285E614CE007100D02672 /* SNRHUDButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 039285E414CE007100D02672 /* SNRHUDButtonCell.m */; };
+ 039285E914CE0B4300D02672 /* SNRHUDTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 039285E714CE0B4200D02672 /* SNRHUDTextView.h */; };
+ 039285EA14CE0B4300D02672 /* SNRHUDTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 039285E814CE0B4300D02672 /* SNRHUDTextView.m */; };
+ 039285ED14CE0B8600D02672 /* SNRHUDScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 039285EB14CE0B8500D02672 /* SNRHUDScrollView.h */; };
+ 039285EE14CE0B8600D02672 /* SNRHUDScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 039285EC14CE0B8500D02672 /* SNRHUDScrollView.m */; };
+ 039285F114CE0C1100D02672 /* SNRHUDImageCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 039285EF14CE0C1000D02672 /* SNRHUDImageCell.h */; };
+ 039285F214CE0C1100D02672 /* SNRHUDImageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 039285F014CE0C1000D02672 /* SNRHUDImageCell.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -57,8 +67,8 @@
0392858A14CCCBF300D02672 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
0392858C14CCCBF300D02672 /* SNRHUDKit-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SNRHUDKit-Prefix.pch"; sourceTree = "<group>"; };
0392858D14CCCBF300D02672 /* SNRHUDKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SNRHUDKit.h; sourceTree = "<group>"; };
- 0392859514CCCC4B00D02672 /* SNRHUDSegmentedControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SNRHUDSegmentedControl.h; path = Classes/SNRHUDSegmentedControl.h; sourceTree = "<group>"; };
- 0392859614CCCC4B00D02672 /* SNRHUDSegmentedControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SNRHUDSegmentedControl.m; path = Classes/SNRHUDSegmentedControl.m; sourceTree = "<group>"; };
+ 0392859514CCCC4B00D02672 /* SNRHUDSegmentedCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SNRHUDSegmentedCell.h; path = Classes/SNRHUDSegmentedCell.h; sourceTree = "<group>"; };
+ 0392859614CCCC4B00D02672 /* SNRHUDSegmentedCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SNRHUDSegmentedCell.m; path = Classes/SNRHUDSegmentedCell.m; sourceTree = "<group>"; };
039285AE14CCD40500D02672 /* Catalog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Catalog.app; sourceTree = BUILT_PRODUCTS_DIR; };
039285B314CCD40500D02672 /* Catalog-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Catalog-Info.plist"; sourceTree = "<group>"; };
039285B514CCD40500D02672 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@@ -72,6 +82,16 @@
039285CD14CCE82700D02672 /* NSBezierPath+MCAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSBezierPath+MCAdditions.m"; path = "Categories/NSBezierPath+MCAdditions.m"; sourceTree = "<group>"; };
039285D014CCF39B00D02672 /* SNRHUDWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SNRHUDWindow.h; path = Classes/SNRHUDWindow.h; sourceTree = "<group>"; };
039285D114CCF39B00D02672 /* SNRHUDWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SNRHUDWindow.m; path = Classes/SNRHUDWindow.m; sourceTree = "<group>"; };
+ 039285D414CDE58700D02672 /* SNRHUDTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SNRHUDTextFieldCell.h; path = Classes/SNRHUDTextFieldCell.h; sourceTree = "<group>"; };
+ 039285D514CDE58800D02672 /* SNRHUDTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SNRHUDTextFieldCell.m; path = Classes/SNRHUDTextFieldCell.m; sourceTree = "<group>"; };
+ 039285E314CE007100D02672 /* SNRHUDButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SNRHUDButtonCell.h; path = Classes/SNRHUDButtonCell.h; sourceTree = "<group>"; };
+ 039285E414CE007100D02672 /* SNRHUDButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SNRHUDButtonCell.m; path = Classes/SNRHUDButtonCell.m; sourceTree = "<group>"; };
+ 039285E714CE0B4200D02672 /* SNRHUDTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SNRHUDTextView.h; path = Classes/SNRHUDTextView.h; sourceTree = "<group>"; };
+ 039285E814CE0B4300D02672 /* SNRHUDTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SNRHUDTextView.m; path = Classes/SNRHUDTextView.m; sourceTree = "<group>"; };
+ 039285EB14CE0B8500D02672 /* SNRHUDScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SNRHUDScrollView.h; path = Classes/SNRHUDScrollView.h; sourceTree = "<group>"; };
+ 039285EC14CE0B8500D02672 /* SNRHUDScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SNRHUDScrollView.m; path = Classes/SNRHUDScrollView.m; sourceTree = "<group>"; };
+ 039285EF14CE0C1000D02672 /* SNRHUDImageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SNRHUDImageCell.h; path = Classes/SNRHUDImageCell.h; sourceTree = "<group>"; };
+ 039285F014CE0C1000D02672 /* SNRHUDImageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SNRHUDImageCell.m; path = Classes/SNRHUDImageCell.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -138,10 +158,20 @@
039285CB14CCE7E700D02672 /* Categories */,
0392858714CCCBF300D02672 /* Supporting Files */,
0392858D14CCCBF300D02672 /* SNRHUDKit.h */,
- 0392859514CCCC4B00D02672 /* SNRHUDSegmentedControl.h */,
- 0392859614CCCC4B00D02672 /* SNRHUDSegmentedControl.m */,
+ 0392859514CCCC4B00D02672 /* SNRHUDSegmentedCell.h */,
+ 0392859614CCCC4B00D02672 /* SNRHUDSegmentedCell.m */,
+ 039285D414CDE58700D02672 /* SNRHUDTextFieldCell.h */,
+ 039285D514CDE58800D02672 /* SNRHUDTextFieldCell.m */,
039285D014CCF39B00D02672 /* SNRHUDWindow.h */,
039285D114CCF39B00D02672 /* SNRHUDWindow.m */,
+ 039285E314CE007100D02672 /* SNRHUDButtonCell.h */,
+ 039285E414CE007100D02672 /* SNRHUDButtonCell.m */,
+ 039285E714CE0B4200D02672 /* SNRHUDTextView.h */,
+ 039285E814CE0B4300D02672 /* SNRHUDTextView.m */,
+ 039285EB14CE0B8500D02672 /* SNRHUDScrollView.h */,
+ 039285EC14CE0B8500D02672 /* SNRHUDScrollView.m */,
+ 039285EF14CE0C1000D02672 /* SNRHUDImageCell.h */,
+ 039285F014CE0C1000D02672 /* SNRHUDImageCell.m */,
);
path = SNRHUDKit;
sourceTree = "<group>";
@@ -196,9 +226,14 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- 0392859714CCCC4B00D02672 /* SNRHUDSegmentedControl.h in Headers */,
+ 0392859714CCCC4B00D02672 /* SNRHUDSegmentedCell.h in Headers */,
039285CE14CCE82700D02672 /* NSBezierPath+MCAdditions.h in Headers */,
039285D214CCF39B00D02672 /* SNRHUDWindow.h in Headers */,
+ 039285D614CDE58800D02672 /* SNRHUDTextFieldCell.h in Headers */,
+ 039285E514CE007100D02672 /* SNRHUDButtonCell.h in Headers */,
+ 039285E914CE0B4300D02672 /* SNRHUDTextView.h in Headers */,
+ 039285ED14CE0B8600D02672 /* SNRHUDScrollView.h in Headers */,
+ 039285F114CE0C1100D02672 /* SNRHUDImageCell.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -295,9 +330,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 0392859814CCCC4B00D02672 /* SNRHUDSegmentedControl.m in Sources */,
+ 0392859814CCCC4B00D02672 /* SNRHUDSegmentedCell.m in Sources */,
039285CF14CCE82700D02672 /* NSBezierPath+MCAdditions.m in Sources */,
039285D314CCF39B00D02672 /* SNRHUDWindow.m in Sources */,
+ 039285D714CDE58800D02672 /* SNRHUDTextFieldCell.m in Sources */,
+ 039285E614CE007100D02672 /* SNRHUDButtonCell.m in Sources */,
+ 039285EA14CE0B4300D02672 /* SNRHUDTextView.m in Sources */,
+ 039285EE14CE0B8600D02672 /* SNRHUDScrollView.m in Sources */,
+ 039285F214CE0C1100D02672 /* SNRHUDImageCell.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
1 SNRHUDKit/Categories/NSBezierPath+MCAdditions.m
@@ -7,7 +7,6 @@
#import "NSBezierPath+MCAdditions.h"
-
@implementation NSBezierPath (MCAdditions)
- (void)fillWithInnerShadow:(NSShadow *)shadow
View
16 SNRHUDKit/Classes/SNRHUDButtonCell.h
@@ -0,0 +1,16 @@
+//
+// SNRHUDButtonCell.h
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import <AppKit/AppKit.h>
+
+// TODO: Drawing images
+// TODO: Checkbox & radio buttons
+
+@interface SNRHUDButtonCell : NSButtonCell
+
+@end
View
112 SNRHUDKit/Classes/SNRHUDButtonCell.m
@@ -0,0 +1,112 @@
+//
+// SNRHUDButtonCell.m
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import "SNRHUDButtonCell.h"
+
+#define SNRButtonBlackGradientBottomColor [NSColor colorWithDeviceWhite:0.150 alpha:1.000]
+#define SNRButtonBlackGradientTopColor [NSColor colorWithDeviceWhite:0.220 alpha:1.000]
+#define SNRButtonBlackHighlightColor [NSColor colorWithDeviceWhite:1.000 alpha:0.050]
+#define SNRButtonBlueGradientBottomColor [NSColor colorWithDeviceRed:0.000 green:0.310 blue:0.780 alpha:1.000]
+#define SNRButtonBlueGradientTopColor [NSColor colorWithDeviceRed:0.000 green:0.530 blue:0.870 alpha:1.000]
+#define SNRButtonBlueHighlightColor [NSColor colorWithDeviceWhite:1.000 alpha:0.250]
+
+#define SNRButtonTextFont [NSFont systemFontOfSize:11.f]
+#define SNRButtonTextColor [NSColor whiteColor]
+#define SNRButtonBlackTextShadowOffset NSMakeSize(0.f, 1.f)
+#define SNRButtonBlackTextShadowBlurRadius 1.f
+#define SNRButtonBlackTextShadowColor [NSColor blackColor]
+#define SNRButtonBlueTextShadowOffset NSMakeSize(0.f, -1.f)
+#define SNRButtonBlueTextShadowBlurRadius 2.f
+#define SNRButtonBlueTextShadowColor [NSColor colorWithDeviceWhite:0.000 alpha:0.600]
+
+#define SNRButtonDisabledAlpha 0.7f
+#define SNRButtonCornerRadius 3.f
+#define SNRButtonDropShadowColor [NSColor colorWithDeviceWhite:1.000 alpha:0.050]
+#define SNRButtonDropShadowBlurRadius 1.f
+#define SNRButtonDropShadowOffset NSMakeSize(0.f, -1.f)
+#define SNRButtonBorderColor [NSColor blackColor]
+#define SNRButtonHighlightOverlayColor [NSColor colorWithDeviceWhite:0.000 alpha:0.300]
+
+static NSString* const SNRButtonReturnKeyEquivalent = @"\r";
+
+@interface SNRHUDButtonCell ()
+- (BOOL)snr_shouldDrawBlueButton;
+@end
+
+@implementation SNRHUDButtonCell {
+ NSBezierPath *__bezelPath;
+}
+
+- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
+{
+ if (![self isEnabled]) {
+ CGContextSetAlpha([[NSGraphicsContext currentContext] graphicsPort], SNRButtonDisabledAlpha);
+ }
+ [super drawWithFrame:cellFrame inView:controlView];
+ if (__bezelPath && [self isHighlighted]) {
+ [SNRButtonHighlightOverlayColor set];
+ [__bezelPath fill];
+ }
+}
+
+- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
+{
+ frame = NSInsetRect(frame, 0.5f, 0.5f);
+ frame.size.height -= SNRButtonDropShadowBlurRadius;
+ BOOL blue = [self snr_shouldDrawBlueButton];
+ __bezelPath = [NSBezierPath bezierPathWithRoundedRect:frame xRadius:SNRButtonCornerRadius yRadius:SNRButtonCornerRadius];
+ NSGradient *gradientFill = [[NSGradient alloc] initWithStartingColor:blue ? SNRButtonBlueGradientBottomColor : SNRButtonBlackGradientBottomColor endingColor:blue ? SNRButtonBlueGradientTopColor : SNRButtonBlackGradientTopColor];
+ // Draw the gradient fill
+ [gradientFill drawInBezierPath:__bezelPath angle:270.f];
+ // Draw the border and drop shadow
+ [NSGraphicsContext saveGraphicsState];
+ [SNRButtonBorderColor set];
+ NSShadow *dropShadow = [NSShadow new];
+ [dropShadow setShadowColor:SNRButtonDropShadowColor];
+ [dropShadow setShadowBlurRadius:SNRButtonDropShadowBlurRadius];
+ [dropShadow setShadowOffset:SNRButtonDropShadowOffset];
+ [dropShadow set];
+ [__bezelPath stroke];
+ [NSGraphicsContext restoreGraphicsState];
+ // Draw the highlight line around the top edge of the pill
+ // Outset the width of the rectangle by 0.5px so that the highlight "bleeds" around the rounded corners
+ // Outset the height by 1px so that the line is drawn right below the border
+ NSRect highlightRect = NSInsetRect(frame, -0.5f, 1.f);
+ // Make the height of the highlight rect something bigger than the bounds so that it won't show up on the bottom
+ highlightRect.size.height *= 2.f;
+ [NSGraphicsContext saveGraphicsState];
+ NSBezierPath *highlightPath = [NSBezierPath bezierPathWithRoundedRect:highlightRect xRadius:SNRButtonCornerRadius yRadius:SNRButtonCornerRadius];
+ [__bezelPath addClip];
+ [blue ? SNRButtonBlueHighlightColor : SNRButtonBlackHighlightColor set];
+ [highlightPath stroke];
+ [NSGraphicsContext restoreGraphicsState];
+}
+
+- (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView
+{
+ BOOL blue = [self snr_shouldDrawBlueButton];
+ NSString *label = [title string];
+ NSShadow *textShadow = [NSShadow new];
+ [textShadow setShadowOffset:blue ? SNRButtonBlueTextShadowOffset : SNRButtonBlackTextShadowOffset];
+ [textShadow setShadowColor:blue ? SNRButtonBlueTextShadowColor : SNRButtonBlackTextShadowColor];
+ [textShadow setShadowBlurRadius:blue ? SNRButtonBlueTextShadowBlurRadius : SNRButtonBlackTextShadowBlurRadius];
+ NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:SNRButtonTextFont, NSFontAttributeName, SNRButtonTextColor, NSForegroundColorAttributeName, textShadow, NSShadowAttributeName, nil];
+ NSAttributedString *attrLabel = [[NSAttributedString alloc] initWithString:label attributes:attributes];
+ NSSize labelSize = attrLabel.size;
+ NSRect labelRect = NSMakeRect(NSMidX(frame) - (labelSize.width / 2.f), NSMidY(frame) - (labelSize.height / 2.f), labelSize.width, labelSize.height);
+ [attrLabel drawInRect:NSIntegralRect(labelRect)];
+ return labelRect;
+}
+
+#pragma mark - Private
+
+- (BOOL)snr_shouldDrawBlueButton
+{
+ return [[self keyEquivalent] isEqualToString:SNRButtonReturnKeyEquivalent];
+}
+@end
View
13 SNRHUDKit/Classes/SNRHUDImageCell.h
@@ -0,0 +1,13 @@
+//
+// SNRHUDImageCell.h
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import <AppKit/AppKit.h>
+
+@interface SNRHUDImageCell : NSImageCell
+
+@end
View
13 SNRHUDKit/Classes/SNRHUDImageCell.m
@@ -0,0 +1,13 @@
+//
+// SNRHUDImageCell.m
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import "SNRHUDImageCell.h"
+
+@implementation SNRHUDImageCell
+
+@end
View
15 SNRHUDKit/Classes/SNRHUDScrollView.h
@@ -0,0 +1,15 @@
+//
+// SNRHUDScrollView.h
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import <AppKit/AppKit.h>
+
+// TODO: Add Snow Leopard HUD scrollers
+
+@interface SNRHUDScrollView : NSScrollView
+
+@end
View
21 SNRHUDKit/Classes/SNRHUDScrollView.m
@@ -0,0 +1,21 @@
+//
+// SNRHUDScrollView.m
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import "SNRHUDScrollView.h"
+
+@implementation SNRHUDScrollView
+
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+ if ((self = [super initWithCoder:aDecoder])) {
+ [self setScrollerKnobStyle:NSScrollerKnobStyleLight];
+ }
+ return self;
+}
+
+@end
View
6 SNRHUDKit/Classes/SNRHUDSegmentedControl.h → SNRHUDKit/Classes/SNRHUDSegmentedCell.h
@@ -1,5 +1,5 @@
//
-// SNRHUDSegmentedControl.h
+// SNRHUDSegmentedCell.h
// SNRHUDKit
//
// Created by Indragie Karunaratne on 12-01-22.
@@ -11,10 +11,6 @@
// TODO: Flexible automatic widths (fixed widths are required right now)
// TODO: Drawing images
-@interface SNRHUDSegmentedControl : NSSegmentedControl
-
-@end
-
@interface SNRHUDSegmentedCell : NSSegmentedCell
@end
View
28 SNRHUDKit/Classes/SNRHUDSegmentedControl.m → SNRHUDKit/Classes/SNRHUDSegmentedCell.m
@@ -1,12 +1,12 @@
//
-// SNRHUDSegmentedControl.m
+// SNRHUDSegmentedCell.m
// SNRHUDKit
//
// Created by Indragie Karunaratne on 12-01-22.
// Copyright (c) 2012 indragie.com. All rights reserved.
//
-#import "SNRHUDSegmentedControl.h"
+#import "SNRHUDSegmentedCell.h"
#import "NSBezierPath+MCAdditions.h"
#define SNRSegControlGradientBottomColor [NSColor colorWithDeviceWhite:0.150 alpha:1.000]
@@ -17,7 +17,7 @@
#define SNRSegControlDividerGradientBottomColor [NSColor colorWithDeviceWhite:0.120 alpha:1.000]
#define SNRSegControlDividerGradientTopColor [NSColor colorWithDeviceWhite:0.160 alpha:1.000]
-#define SNRSegControlHighlightColor [NSColor colorWithDeviceWhite:1.000 alpha:0.100]
+#define SNRSegControlHighlightColor [NSColor colorWithDeviceWhite:1.000 alpha:0.050]
#define SNRSegControlHighlightOverlayColor [NSColor colorWithDeviceWhite:0.000 alpha:0.300]
#define SNRSegControlBorderColor [NSColor blackColor]
#define SNRSegControlCornerRadius 3.f
@@ -38,19 +38,12 @@
#define SNRSegControlTextShadowBlurRadius 1.f
#define SNRSegControlTextShadowColor [NSColor blackColor]
+#define SNRSegControlDisabledAlpha 0.7f
+
// This is a value that is set internally by AppKit, used for layout purposes in this code
// Don't change this
#define SNRSegControlDivderWidth 3.f
-@implementation SNRHUDSegmentedControl
-
-// Doesn't seem to work when the control is created from Interface Builder
-+ (Class)cellClass
-{
- return [SNRHUDSegmentedCell class];
-}
-@end
-
@interface SNRHUDSegmentedCell ()
// Returns the bezier path that the border was drawn in
- (NSBezierPath*)snr_drawBackgroundWithFrame:(NSRect)cellFrame inView:(NSView*)controlView;
@@ -62,6 +55,10 @@ @implementation SNRHUDSegmentedCell
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
+ CGContextRef ctx = [[NSGraphicsContext currentContext] graphicsPort];
+ if (![self isEnabled]) {
+ CGContextSetAlpha(ctx, SNRSegControlDisabledAlpha);
+ }
// The frame needs to be inset 0.5px to make the border line crisp
// because NSBezierPath draws the stroke centered on the bounds of the rect
// This means that 0.5px of the 1px stroke line will be outside the rect and the other half will be inside
@@ -83,7 +80,12 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
width += SNRSegControlDivderWidth;
}
NSRect frame = NSMakeRect(bounds.origin.x + currentOrigin, bounds.origin.y, width, bounds.size.height);
+ [NSGraphicsContext saveGraphicsState];
+ if ([self isEnabled] && ![self isEnabledForSegment:i]) {
+ CGContextSetAlpha(ctx, SNRSegControlDisabledAlpha);
+ }
[self drawSegment:i inFrame:frame withView:controlView];
+ [NSGraphicsContext restoreGraphicsState];
currentOrigin += width;
}
}
@@ -135,7 +137,7 @@ - (void)drawSegment:(NSInteger)segment inFrame:(NSRect)frame withView:(NSView *)
[path fillWithInnerShadow:innerShadow];
}
[self snr_drawInteriorOfSegment:segment inFrame:frame];
- NSEvent *currentEvent = [NSApp currentEvent]; // This is probably a dirty way of doing this
+ NSEvent *currentEvent = [NSApp currentEvent]; // This is probably a dirty way of figuring out whether to highlight
if (currentEvent.type == NSLeftMouseDown) {
NSPoint location = [controlView convertPoint:[currentEvent locationInWindow] fromView:nil];
if (NSPointInRect(location, frame)) {
View
13 SNRHUDKit/Classes/SNRHUDTextFieldCell.h
@@ -0,0 +1,13 @@
+//
+// SNRHUDTextFieldCell.h
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import <AppKit/AppKit.h>
+
+@interface SNRHUDTextFieldCell : NSTextFieldCell
+
+@end
View
86 SNRHUDKit/Classes/SNRHUDTextFieldCell.m
@@ -0,0 +1,86 @@
+//
+// SNRHUDTextFieldCell.m
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import "SNRHUDTextFieldCell.h"
+#import "NSBezierPath+MCAdditions.h"
+
+#define SNRTextFieldTextColor [NSColor whiteColor]
+#define SNRTextFieldSelectedTextBackgroundColor [NSColor darkGrayColor]
+
+#define SNRTextFieldBackgroundColor [NSColor colorWithDeviceWhite:0.000 alpha:0.150]
+#define SNRTextFieldInnerGlowColor [NSColor colorWithDeviceWhite:0.000 alpha:0.300]
+#define SNRTextFieldInnerGlowOffset NSMakeSize(0.f, 0.f)
+#define SNRTextFieldInnerGlowBlurRadius 3.f
+
+#define SNRTextFieldInnerShadowColor [NSColor colorWithDeviceWhite:0.000 alpha:0.400]
+#define SNRTextFieldInnerShadowOffset NSMakeSize(0.f, -1.f)
+#define SNRTextFieldInnerShadowBlurRadius 3.f
+
+#define SNRTextFieldDropShadowColor [NSColor colorWithDeviceWhite:1.000 alpha:0.100]
+
+#define SNRTextFieldDisabledAlpha 0.7f
+
+@implementation SNRHUDTextFieldCell
+
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+ if ((self = [super initWithCoder:aDecoder])) {
+ [self setTextColor:SNRTextFieldTextColor];
+ [self setDrawsBackground:NO];
+ [self setFocusRingType:NSFocusRingTypeNone];
+ }
+ return self;
+}
+
+- (NSText*)setUpFieldEditorAttributes:(NSText *)textObj
+{
+ NSTextView *fieldEditor = (NSTextView*)[super setUpFieldEditorAttributes:textObj];
+ NSColor *textColor = SNRTextFieldTextColor;
+ [fieldEditor setInsertionPointColor:textColor];
+ [fieldEditor setTextColor:textColor];
+ [fieldEditor setDrawsBackground:NO];
+ NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithDictionary:[fieldEditor selectedTextAttributes]];
+ [attributes setObject:SNRTextFieldSelectedTextBackgroundColor forKey:NSBackgroundColorAttributeName];
+ [fieldEditor setSelectedTextAttributes:attributes];
+ return fieldEditor;
+}
+
+- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
+{
+ if (![self isEnabled]) {
+ CGContextSetAlpha([[NSGraphicsContext currentContext] graphicsPort], SNRTextFieldDisabledAlpha);
+ }
+ NSRect backgroundRect = cellFrame;
+ backgroundRect.size.height -= 1.f;
+ NSBezierPath *backgroundPath = [NSBezierPath bezierPathWithRect:backgroundRect];
+ [SNRTextFieldBackgroundColor set];
+ [backgroundPath fill];
+ NSShadow *innerGlow = [NSShadow new];
+ [innerGlow setShadowColor:SNRTextFieldInnerGlowColor];
+ [innerGlow setShadowOffset:SNRTextFieldInnerGlowOffset];
+ [innerGlow setShadowBlurRadius:SNRTextFieldInnerGlowBlurRadius];
+ [backgroundPath fillWithInnerShadow:innerGlow];
+ NSRect innerShadowRect = NSInsetRect(backgroundRect, -2.f, 0.f);
+ innerShadowRect.size.height *= 2.f;
+ NSBezierPath *shadowPath = [NSBezierPath bezierPathWithRect:innerShadowRect];
+ NSShadow *innerShadow = [NSShadow new];
+ [innerShadow setShadowColor:SNRTextFieldInnerShadowColor];
+ [innerShadow setShadowOffset:SNRTextFieldInnerShadowOffset];
+ [innerShadow setShadowBlurRadius:SNRTextFieldInnerShadowBlurRadius];
+ [shadowPath fillWithInnerShadow:innerShadow];
+ NSRect dropShadowRect = backgroundRect;
+ dropShadowRect.origin.y = NSMaxY(cellFrame) - 1.f;
+ [SNRTextFieldDropShadowColor set];
+ [NSBezierPath fillRect:dropShadowRect];
+
+ // Draw the text vertically centered
+ NSSize textSize = [self cellSizeForBounds:cellFrame];
+ NSRect textRect = NSMakeRect(backgroundRect.origin.x, NSMidY(backgroundRect) - (textSize.height / 2.f), backgroundRect.size.width, textSize.height);
+ [self drawInteriorWithFrame:textRect inView:controlView];
+}
+@end
View
13 SNRHUDKit/Classes/SNRHUDTextView.h
@@ -0,0 +1,13 @@
+//
+// SNRHUDTextView.h
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import <AppKit/AppKit.h>
+
+@interface SNRHUDTextView : NSTextView
+
+@end
View
77 SNRHUDKit/Classes/SNRHUDTextView.m
@@ -0,0 +1,77 @@
+//
+// SNRHUDTextView.m
+// SNRHUDKit
+//
+// Created by Indragie Karunaratne on 12-01-23.
+// Copyright (c) 2012 indragie.com. All rights reserved.
+//
+
+#import "SNRHUDTextView.h"
+#import "NSBezierPath+MCAdditions.h"
+
+#define SNRTextViewTextColor [NSColor whiteColor]
+#define SNRTextViewFont [NSFont systemFontOfSize:11.f]
+#define SNRTextViewSelectedTextBackgroundColor [NSColor darkGrayColor]
+
+#define SNRTextViewBackgroundColor [NSColor colorWithDeviceWhite:0.000 alpha:0.150]
+#define SNRTextViewInnerGlowColor [NSColor colorWithDeviceWhite:0.000 alpha:0.300]
+#define SNRTextViewInnerGlowOffset NSMakeSize(0.f, 0.f)
+#define SNRTextViewInnerGlowBlurRadius 3.f
+
+#define SNRTextViewInnerShadowColor [NSColor colorWithDeviceWhite:0.000 alpha:0.400]
+#define SNRTextViewInnerShadowOffset NSMakeSize(0.f, -1.f)
+#define SNRTextViewInnerShadowBlurRadius 3.f
+
+#define SNRTextViewDropShadowColor [NSColor colorWithDeviceWhite:1.000 alpha:0.100]
+#define SNRTextViewTextContainerInset NSMakeSize(0.f, 2.f)
+
+@implementation SNRHUDTextView
+
+- (void)awakeFromNib
+{
+ [super awakeFromNib];
+ NSScrollView *scrollView = [self enclosingScrollView];
+ [scrollView setBorderType:NSNoBorder];
+ [scrollView setDrawsBackground:NO];
+ [scrollView setHorizontalScrollElasticity:NSScrollElasticityNone];
+ [scrollView setVerticalScrollElasticity:NSScrollElasticityNone];
+ [scrollView setScrollerKnobStyle:NSScrollerKnobStyleLight];
+ NSColor *textColor = SNRTextViewTextColor;
+ [self setInsertionPointColor:textColor];
+ [self setTextColor:textColor];
+ [self setDrawsBackground:NO];
+ [self setFont:SNRTextViewFont];
+ [self setTextContainerInset:SNRTextViewTextContainerInset];
+ NSMutableDictionary *dict = [[self selectedTextAttributes] mutableCopy];
+ [dict setObject:SNRTextViewSelectedTextBackgroundColor forKey:NSBackgroundColorAttributeName];
+ [self setSelectedTextAttributes:dict];
+}
+
+- (void)drawViewBackgroundInRect:(NSRect)rect
+{
+ NSRect backgroundRect = [self visibleRect];
+ backgroundRect.size.height -= 1.f;
+ NSBezierPath *backgroundPath = [NSBezierPath bezierPathWithRect:backgroundRect];
+ [SNRTextViewBackgroundColor set];
+ [backgroundPath fill];
+ NSShadow *innerGlow = [NSShadow new];
+ [innerGlow setShadowColor:SNRTextViewInnerGlowColor];
+ [innerGlow setShadowOffset:SNRTextViewInnerGlowOffset];
+ [innerGlow setShadowBlurRadius:SNRTextViewInnerGlowBlurRadius];
+ [backgroundPath fillWithInnerShadow:innerGlow];
+ NSRect innerShadowRect = NSInsetRect(backgroundRect, -2.f, 0.f);
+ innerShadowRect.size.height *= 2.f;
+ NSBezierPath *shadowPath = [NSBezierPath bezierPathWithRect:innerShadowRect];
+ NSShadow *innerShadow = [NSShadow new];
+ [innerShadow setShadowColor:SNRTextViewInnerShadowColor];
+ [innerShadow setShadowOffset:SNRTextViewInnerShadowOffset];
+ [innerShadow setShadowBlurRadius:SNRTextViewInnerShadowBlurRadius];
+ [shadowPath fillWithInnerShadow:innerShadow];
+ NSRect dropShadowRect = backgroundRect;
+ dropShadowRect.origin.y = NSMaxY([self visibleRect]) - 1.f;
+ [SNRTextViewDropShadowColor set];
+ [NSBezierPath fillRect:dropShadowRect];
+ [super drawViewBackgroundInRect:rect];
+}
+
+@end
View
17 SNRHUDKit/Classes/SNRHUDWindow.m
@@ -8,12 +8,12 @@
#import "SNRHUDWindow.h"
-#define SNRWindowTitlebarHeight 22.f
-#define SNRWindowBorderColor [NSColor blackColor]
-#define SNRWindowTopColor [NSColor colorWithDeviceWhite:0.240 alpha:0.960]
-#define SNRWindowBottomColor [NSColor colorWithDeviceWhite:0.150 alpha:0.960]
-#define SNRWindowHighlightColor [NSColor colorWithDeviceWhite:1.000 alpha:0.200]
-#define SNRWindowCornerRadius 5.f
+#define SNRWindowTitlebarHeight 22.f
+#define SNRWindowBorderColor [NSColor blackColor]
+#define SNRWindowTopColor [NSColor colorWithDeviceWhite:0.240 alpha:0.960]
+#define SNRWindowBottomColor [NSColor colorWithDeviceWhite:0.150 alpha:0.960]
+#define SNRWindowHighlightColor [NSColor colorWithDeviceWhite:1.000 alpha:0.200]
+#define SNRWindowCornerRadius 5.f
#define SNRWindowTitleFont [NSFont systemFontOfSize:11.f]
#define SNRWindowTitleColor [NSColor colorWithDeviceWhite:0.700 alpha:1.000]
@@ -73,6 +73,11 @@ - (void)setContentView:(NSView *)aView
[__customContentView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[frameView addSubview:__customContentView];
}
+
+- (BOOL)canBecomeKeyWindow
+{
+ return YES;
+}
@end
@implementation SNRHUDWindowFrameView
View
3 SNRHUDKit/SNRHUDKit.h
@@ -5,6 +5,3 @@
// Created by Indragie Karunaratne on 12-01-22.
// Copyright (c) 2012 indragie.com. All rights reserved.
//
-
-#import <SNRHUDKit/SNRHUDSegmentedControl.h>
-#import <SNRHUDKit/SNRHUDWindow.h>

0 comments on commit d1bdbe9

Please sign in to comment.