Skip to content
Browse files

updating color selection menu (clearing logs), creating a custom quer…

…y menu, cleaning old query menu
  • Loading branch information...
1 parent 0547672 commit 1a225c595c7b464261fcddfe7c948a7fdb9aec28 @tomcool420 committed
Showing with 191 additions and 11 deletions.
  1. +2 −1 SMFColorSelectionMenu.m
  2. +32 −0 SMFCustomQueryMenu.h
  3. +147 −0 SMFCustomQueryMenu.m
  4. +6 −1 SMFQueryMenu.h
  5. +4 −9 SMFQueryMenu.m
View
3 SMFColorSelectionMenu.m
@@ -74,9 +74,10 @@ -(id)init
}
-(void)itemSelected:(long)selected
{
+ NSLog(@"sending message to delegate 0");
if ([self.delegate conformsToProtocol:@protocol(SMFColorSelectionDelegate)])
{
-
+ NSLog(@"sending message to delegate 1");
NSArray *colorArray = [NSArray arrayWithObjects:
SMFFloat(red[selected]),
SMFFloat(green[selected]),
View
32 SMFCustomQueryMenu.h
@@ -0,0 +1,32 @@
+//
+// SMFCustomQueryMenu.h
+// SMFramework
+//
+// Created by Thomas Cool on 5/10/11.
+// Copyright 2011 Thomas Cool. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <Backrow/BackRow.h>
+#import "SMFMediaMenuController.h"
+typedef enum _kSMFSearchStatus
+{
+ kSMFSearchStarted=0,
+ kSMFSearchDone,
+}kSMFSearchStatus;
+@class SMFCustomQueryMenu;
+@protocol SMFCustomQueryMenuDelegate
+-(void)queryMenu:(SMFCustomQueryMenu *)q itemSelected:(NSObject *)it;
+@end
+
+@interface SMFCustomQueryMenu : BRMediaMenuController {
+ BRTextEntryControl * _entryControl;
+ NSString * _lastSearchedQuery;
+ NSObject<SMFCustomQueryMenuDelegate> * _delegate;
+ BRWaitSpinnerControl *_spi;
+}
+@property (copy)NSString *lastSearchedQuery;
+@property (assign)NSObject<SMFCustomQueryMenuDelegate> * delegate;
+@property (readonly)BRWaitSpinnerControl * spinner;
+-(void)search:(NSString *)searchString;
+@end
View
147 SMFCustomQueryMenu.m
@@ -0,0 +1,147 @@
+//
+// SMFQueryMenu.m
+// SMFramework
+//
+// Created by Thomas Cool on 11/5/10.
+// Copyright 2010 tomcool.org. All rights reserved.
+//
+
+#import "SMFCustomQueryMenu.h"
+#import "SMFMenuItem.h"
+#import "SMFMediaPreview.h"
+
+@implementation SMFCustomQueryMenu
+@synthesize lastSearchedQuery=_lastSearchedQuery;
+@synthesize delegate=_delegate;
+@synthesize spinner =_spi;
+-(id)previewControlForItem:(long)item
+{
+ if ([_entryControl isHidden]) {
+ return [SMFMediaPreview simplePreviewWithTitle:[self titleForRow:item] withSummary:nil withImage:[[BRThemeInfo sharedTheme]appleTVIcon]];
+ }
+ return nil;
+
+}
+-(id)init;
+{
+ self=[super init];
+ _entryControl=[[BRTextEntryControl alloc] initWithTextEntryStyle:2];
+ [_entryControl setTextFieldDelegate:self];
+ CGRect f = [BRWindow interfaceFrame];
+ f.size.width=f.size.width/3.f;
+ double extra = [BRWindow interfaceFrame].size.width*(1/2.0f-1/3.0f)/2.0f;
+ f.origin=CGPointMake(extra, 100.0f);
+ [_entryControl setFrame:f];
+ [[self list] setDatasource:self];
+ [_entryControl setHidden:YES];
+
+ _spi=[[BRWaitSpinnerControl alloc] init];
+ CGRect sf=[BRWindow interfaceFrame];
+ sf.size.width=sf.size.height*0.1;
+ sf.origin.x=sf.size.width*1.0;
+ sf.origin.y=sf.size.height-sf.size.width*1.5;
+ sf.size.height=sf.size.width;
+ [_spi setFrame:sf];
+// BRCursorControl *cc=[[BRCursorControl alloc]init];
+// [self addControl:[cc autorelease]];
+ return self;
+}
+-(void)layoutSubcontrols
+{
+ [super layoutSubcontrols];
+ [self addControl:_entryControl];
+ [self addControl:_spi];
+}
+-(void)reloadItems
+{
+ [[self list] reload];
+}
+- (void) textDidChange: (id) sender
+{
+ self.lastSearchedQuery=[[_entryControl textField] stringValue];
+ [self search:self.lastSearchedQuery];
+}
+
+- (void) textDidEndEditing: (id) sender
+{
+
+}
+
+-(void)wasPushed
+{
+ [super wasPushed];
+
+
+}
+-(BOOL)brEventAction:(id)action
+{
+ switch ([action remoteAction]) {
+ case kBREventRemoteActionRight:
+ {
+ BRControl *old = [self focusedControl];
+ BOOL r = [super brEventAction:action];
+ BRControl *new = [self focusedControl];
+ if (old==_entryControl && new!=_entryControl) {
+
+ [_entryControl setHidden:YES];
+ [self resetPreviewController];
+ }
+ return r;
+ }
+ case kBREventRemoteActionLeft:
+ {
+ BRControl *old = [self focusedControl];
+ BOOL r = [super brEventAction:action];
+ BRControl *new = [self focusedControl];
+ if (new==_entryControl && old!=_entryControl) {
+
+ [_entryControl setHidden:NO];
+ [self resetPreviewController];
+
+ }
+ return r;
+ }
+
+ break;
+ default:
+ break;
+ }
+ return [super brEventAction:action];
+}
+
+- (long)defaultIndex { return 0;}
+-(void)dealloc
+{
+ [_entryControl removeFromParent];
+ [_entryControl release];
+ _entryControl=nil;
+ [super dealloc];
+}
+
+#pragma mark methods to overwrite
+-(long)itemCount
+{
+ return (long)2;
+}
+-(id)itemForRow:(long)row
+{
+ SMFMenuItem *menuItem= [SMFMenuItem menuItem];
+ [menuItem setTitle:@"Hello"];
+ return menuItem;
+}
+-(id)titleForRow:(long)row
+{
+ return @"Hello";
+}
+-(void)itemSelected:(long)selected
+{
+ return;
+}
+- (float)heightForRow:(long)row { return 0.0f;}
+- (BOOL)rowSelectable:(long)row { return YES;}
+
+-(void)search:(NSString *)searchString
+{
+ //Do Something
+}
+@end
View
7 SMFQueryMenu.h
@@ -13,14 +13,19 @@
-(void)queryMenu:(SMFQueryMenu *)q itemSelected:(NSString *)it;
@end
-@interface SMFQueryMenu : BRMenuController {
+@interface SMFQueryMenu : BRMediaMenuController {
BRTextEntryControl * _entryControl;
NSMutableArray * _items;
NSMutableArray * _filteredArray;
id<SMFQueryDelegate> _delegate;
+ NSPredicate * _predicate;
}
+@property (retain)NSArray *items;
+@property (retain)NSPredicate *predicate;
+@property (assign)id<SMFQueryDelegate> delegate;
-(void)setDelegate:(id<SMFQueryDelegate>)d;
-(id<SMFQueryDelegate>)delegate;
+-(void)startFiltering:(NSString *)filterString;
@end
View
13 SMFQueryMenu.m
@@ -10,7 +10,9 @@
@implementation SMFQueryMenu
-
+@synthesize items=_items;
+@synthesize delegate=_delegate;
+@synthesize predicate=_predicate;
-(id)init;
{
self=[super init];
@@ -29,14 +31,7 @@ -(id)init;
[self setListTitle:@"Time Zone"];
return self;
}
--(void)setDelegate:(id<SMFQueryDelegate>)d
-{
- _delegate=d;
-}
--(id<SMFQueryDelegate>)delegate
-{
- return _delegate;
-}
+
-(void)reloadItems
{
NSString *filter = [[[_entryControl textField]stringValue] stringByReplacingOccurrencesOfString:@" " withString:@"_"];

0 comments on commit 1a225c5

Please sign in to comment.
Something went wrong with that request. Please try again.