Permalink
Browse files

show no patterns lable

  • Loading branch information...
1 parent a93fb18 commit c2956905ba0defda2e94100a86b29fa8417eab86 @mattrajca mattrajca committed Feb 25, 2013
View
91 English.lproj/PXSelectPattern.xib
@@ -19,6 +19,8 @@
<string>NSCustomView</string>
<string>NSScrollView</string>
<string>NSScroller</string>
+ <string>NSTextField</string>
+ <string>NSTextFieldCell</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -94,6 +96,43 @@
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
+ <object class="NSTextField" id="524324934">
+ <reference key="NSNextResponder" ref="1005"/>
+ <int key="NSvFlags">-2147483379</int>
+ <string key="NSFrame">{{55, 123}, {66, 14}}</string>
+ <reference key="NSSuperview" ref="1005"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="584266188"/>
+ <string key="NSReuseIdentifierKey">_NS:1535</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="555252118">
+ <int key="NSCellFlags">68157504</int>
+ <int key="NSCellFlags2">272761856</int>
+ <string key="NSContents">No Patterns</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSCellIdentifier">_NS:1535</string>
+ <reference key="NSControlView" ref="524324934"/>
+ <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" id="709231445">
+ <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>
+ <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+ </object>
<object class="NSScrollView" id="54811224">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">4370</int>
@@ -135,10 +174,7 @@
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlBackgroundColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
+ <reference key="NSColor" ref="709231445"/>
</object>
<int key="NScvFlags">2</int>
</object>
@@ -148,7 +184,7 @@
<string key="NSFrame">{{234, 1}, {15, 143}}</string>
<reference key="NSSuperview" ref="54811224"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="584266188"/>
+ <reference key="NSNextKeyView" ref="524324934"/>
<string key="NSReuseIdentifierKey">_NS:82</string>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<reference key="NSTarget" ref="54811224"/>
@@ -231,6 +267,14 @@
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
+ <string key="label">noPatternsLabel</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="524324934"/>
+ </object>
+ <int key="connectionID">24</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
<string key="label">itemPrototype</string>
<reference key="source" ref="15732746"/>
<reference key="destination" ref="97160644"/>
@@ -271,6 +315,7 @@
<reference ref="54811224"/>
<reference ref="519559112"/>
<reference ref="584266188"/>
+ <reference ref="524324934"/>
</array>
<reference key="parent" ref="0"/>
</object>
@@ -330,6 +375,19 @@
<reference key="object" ref="193553493"/>
<reference key="parent" ref="584266188"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">22</int>
+ <reference key="object" ref="524324934"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="555252118"/>
+ </array>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">23</int>
+ <reference key="object" ref="555252118"/>
+ <reference key="parent" ref="524324934"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -340,6 +398,8 @@
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="22.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="23.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference key="6.IBCollectionViewIntegration.primaryColor" ref="842477122"/>
@@ -353,7 +413,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">21</int>
+ <int key="maxID">24</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -403,17 +463,20 @@
<string key="candidateClassName">id</string>
</object>
</dictionary>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">collectionView</string>
- <string key="NS.object.0">NSCollectionView</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">collectionView</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
+ <dictionary class="NSMutableDictionary" key="outlets">
+ <string key="collectionView">NSCollectionView</string>
+ <string key="noPatternsLabel">NSTextField</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="collectionView">
<string key="name">collectionView</string>
<string key="candidateClassName">NSCollectionView</string>
</object>
- </object>
+ <object class="IBToOneOutletInfo" key="noPatternsLabel">
+ <string key="name">noPatternsLabel</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ </dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/PXSelectPatternController.h</string>
View
1 Pixen Application/Tools/Patterns/PXSelectPatternController.h
@@ -12,6 +12,7 @@
@interface PXSelectPatternController : NSViewController
@property (nonatomic, weak) IBOutlet NSCollectionView *collectionView;
+@property (nonatomic, weak) IBOutlet NSTextField *noPatternsLabel;
@property (nonatomic, weak) NSPopover *popover;
View
13 Pixen Application/Tools/Patterns/PXSelectPatternController.m
@@ -15,7 +15,7 @@
@implementation PXSelectPatternController
-@synthesize collectionView, popover, delegate;
+@synthesize collectionView, noPatternsLabel, popover, delegate;
- (id)init
{
@@ -29,11 +29,14 @@ - (id)init
- (void)dealloc
{
[collectionView removeObserver:self forKeyPath:@"selectionIndexes"];
+ [collectionView removeObserver:self forKeyPath:@"content"];
}
- (void)awakeFromNib
{
[self.collectionView addObserver:self forKeyPath:@"selectionIndexes" options:0 context:NULL];
+ [self.collectionView addObserver:self forKeyPath:@"content" options:0 context:NULL];
+
[self.collectionView bind:@"content" toObject:[[PXPatternEditorController sharedController] patternsController] withKeyPath:@"arrangedObjects" options:nil];
}
@@ -49,6 +52,14 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
[self.popover close];
}
}
+ else if ([keyPath isEqualToString:@"content"]) {
+ if ([[self.collectionView content] count]) {
+ [self.noPatternsLabel setHidden:YES];
+ }
+ else {
+ [self.noPatternsLabel setHidden:NO];
+ }
+ }
}
- (IBAction)closePopover:(id)sender

0 comments on commit c295690

Please sign in to comment.