doc
 All Classes Functions Variables Properties
/Users/rburkes/Projects/mobile/branches/release-1-2/devices/iphone/core/src/EMLib/EMSearchController.h
00001 /*
00002 Copyright 2001, 2012, Oracle and/or its affiliates. All rights reserved.
00003 Oracle and Java are registered trademarks of Oracle and/or its 
00004 affiliates. Other names may be trademarks of their respective owners.
00005 UNIX is a registered trademark of The Open Group.
00006 
00007 This software and related documentation are provided under a license 
00008 agreement containing restrictions on use and disclosure and are 
00009 protected by intellectual property laws. Except as expressly permitted 
00010 in your license agreement or allowed by law, you may not use, copy, 
00011 reproduce, translate, broadcast, modify, license, transmit, distribute, 
00012 exhibit, perform, publish, or display any part, in any form, or by any 
00013 means. Reverse engineering, disassembly, or decompilation of this 
00014 software, unless required by law for interoperability, is prohibited.
00015 The information contained herein is subject to change without notice 
00016 and is not warranted to be error-free. If you find any errors, please 
00017 report them to us in writing.
00018 U.S. GOVERNMENT END USERS: Oracle programs, including any operating 
00019 system, integrated software, any programs installed on the hardware, 
00020 and/or documentation, delivered to U.S. Government end users are 
00021 "commercial computer software" pursuant to the applicable Federal 
00022 Acquisition Regulation and agency-specific supplemental regulations. 
00023 As such, use, duplication, disclosure, modification, and adaptation 
00024 of the programs, including any operating system, integrated software, 
00025 any programs installed on the hardware, and/or documentation, shall be 
00026 subject to license terms and license restrictions applicable to the 
00027 programs. No other rights are granted to the U.S. Government.
00028 This software or hardware is developed for general use in a variety 
00029 of information management applications. It is not developed or 
00030 intended for use in any inherently dangerous applications, including 
00031 applications that may create a risk of personal injury. If you use 
00032 this software or hardware in dangerous applications, then you shall 
00033 be responsible to take all appropriate fail-safe, backup, redundancy, 
00034 and other measures to ensure its safe use. Oracle Corporation and its 
00035 affiliates disclaim any liability for any damages caused by use of this 
00036 software or hardware in dangerous applications.
00037 This software or hardware and documentation may provide access to or 
00038 information on content, products, and services from third parties. 
00039 Oracle Corporation and its affiliates are not responsible for and 
00040 expressly disclaim all warranties of any kind with respect to 
00041 third-party content, products, and services. Oracle Corporation and 
00042 its affiliates will not be responsible for any loss, costs, or damages 
00043 incurred due to your access to or use of third-party content, products, 
00044 or services.
00045 */
00046 
00047 
00048 #import <UIKit/UIKit.h>
00049 #import <Three20/Three20.h>
00050 
00055 @class EMSearchController;
00056 
00060 @protocol EMSearchQueryControllerDelegate <NSObject>
00061 
00065 - (UIView *)resultsViewForController:(EMSearchController *)controller;
00066 
00070 - (UIView *)noResultsViewForController:(EMSearchController *)controller;
00071 
00075 - (UIView *)errorViewForController:(EMSearchController *)controller withError:(NSError *)error;
00076 
00080 - (UIView *)loadingViewForController:(EMSearchController *)controller;
00081 
00082 @end
00083 
00084 #pragma mark -
00085 
00086 @class EMSearchBar, EMTypeaheadDataSource, EMSearchQueryDataSource, EMSearchQuery;
00087 
00091 @interface EMSearchController : UIViewController <UITextFieldDelegate, UIScrollViewDelegate, EMSearchQueryControllerDelegate> {
00092         
00096         EMSearchBar *_searchBar;
00097 
00098         TTView *_sortBar;
00099         UISegmentedControl *_sortControl;
00100         UIBarButtonItem *_fButton;
00101         
00102         
00103         UIView *_noResultsView, *_errorView, *_loadingView;
00104         
00105         UILabel *_errorLabel;
00106         
00110         BOOL _showFacetsForEmptyQuery;
00111         BOOL _showResultsForEmptyQuery;
00112         
00113         BOOL _searchBarVisible;
00114         NSString *_searchKey; // Only relevant if searchBarVisible = YES
00115         BOOL _searchBarCancelButtonVisible; // Only relevant if searchBarVisible = YES
00116         BOOL _searchBarFirstResponderEnabled; // Only relevant if searchBarVisible = YES
00117         
00118         
00119         BOOL _sortBarVisible;
00120         NSArray *_sortOptions; // Only relevant if sortBarVisible = YES
00121         BOOL _sortBarScrollable; // Only relvant if sortBarVisible = YES
00122         BOOL _sortBarStartsAboveFold; // Only relevant if sortBarScrollable = YES
00123         
00124         BOOL _pushDetailControllerForSingleResult;
00125         
00129         NSError *_error;
00130         
00131         NSString *_previousSearchBarText;
00132         
00133         BOOL _cancellingKeyboard;
00134         
00135         BOOL _reload;
00136         BOOL _showingFilterView;
00137         BOOL _showingKeyboard;
00138         
00139         BOOL _viewDidAppear;
00140         BOOL _viewDidLoad;
00141         
00142         UIView *_currentView;
00143         
00147         EMTypeaheadDataSource *_keywordsSource;
00148         EMSearchQueryDataSource *_dataSource;
00149         id<EMSearchQueryControllerDelegate> _delegate;
00150 
00151 }
00152 
00153 - (id) initWithSearchQueryDataSource:(EMSearchQueryDataSource *)searchQueryDataSource;
00154 
00155 #pragma mark -
00156 #pragma mark Data Sources / Delegates
00157 
00161 @property (nonatomic, retain) EMSearchQuery *query;
00162 
00163 
00167 @property (nonatomic, retain) EMSearchQueryDataSource *dataSource;
00168 
00173 @property (nonatomic, assign) id<EMSearchQueryControllerDelegate> delegate;
00174 
00175 #pragma mark -
00176 #pragma mark User Interface Elements
00177 
00178 
00179 @property (nonatomic, readonly) EMSearchBar *searchBar;
00180 
00181 #pragma mark -
00182 #pragma mark Configuration Options
00183 
00189 @property (nonatomic, retain) NSString *searchKey;
00190 
00194 @property (nonatomic, assign) BOOL searchBarCancelButtonVisible;
00195 
00199 @property (nonatomic, assign) BOOL searchBarVisible;
00200 
00209 @property (nonatomic, retain) NSArray *sortOptions;
00210 
00211 #pragma mark -
00212 #pragma mark For subclass customization
00213 
00217 - (void) adjustNavigationItem;
00218 
00222 - (void) adjustSortBar;
00223 
00224 #pragma mark -
00225 #pragma mark For scroll views to update the sort bar position
00226 
00227 - (void) positionSortBar;
00228 
00229 
00230 @end