doc
 All Classes Functions Variables Properties
/Users/rburkes/Projects/mobile/branches/release-1-2/devices/iphone/core/src/EMLib/EMStoreLocatorViewController.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 <MapKit/MapKit.h>
00050 #import <AddressBookUI/AddressBookUI.h>
00051 #import <Three20/Three20.h>
00052 #import <Three20/Three20+Additions.h>
00053 #import "EMMapAnnotation.h"
00054 #import "EMPageableDataSource.h"
00055 #import "EMStore.h"
00056 #import "EMStoreListTableView.h"
00057 #import "EMSearchTextField.h"
00058 #import "EMLoadingView.h"
00059 #import "EMSelectFromContacts.h"
00060 #import "EMStoreInfoController.h"
00061 
00067 typedef enum {
00068         EMStoreLocatorSearchFieldOptionLocationAndKeyword = 1,
00069         EMStoreLocatorSearchFieldOptionLocation = 0
00070 } EMStoreLocatorSearchFieldOption;
00071 
00072 typedef enum {
00073         EMSearchTextFieldLocationOptionSearchOnNavBar = 1,
00074         EMSearchTextFieldLocationOptionSearchOnToolbar = 0
00075 } EMSearchTextFieldLocationOption;
00076 
00077 @interface EMStoreLocatorViewController : UIViewController <MKMapViewDelegate,
00078 CLLocationManagerDelegate, EMPageableDataSourceDelegate, UITextFieldDelegate,
00079 UITableViewDelegate, UITableViewDataSource,
00080 EMStoreListTableViewDelegate, EMStoreInfoControllerDelegate, EMSelectFromContactsDelegate,
00081 UIAlertViewDelegate> {
00082         MKMapView *_mapView;
00083         EMMapAnnotation* _annotation;
00084         EMSearchQueryDataSource *_dataSource;
00085         
00086         CLLocation *_location;
00087         
00088         //Endeca Property which corresponds to geocodes
00089         NSString *_geoFilterProperty;
00090         
00091         //Search radius
00092         CGFloat _searchRadius;
00093         
00094         //Flag for updating map location while moving
00095         //Default: NO, not implemented fully
00096         BOOL _shouldCenterToCurrentLocation;
00097         
00098         // Grey background overlay that shows up when they keyboard displayed - clicking this will cancel the keyboard
00099         UIButton *_greyBackgroundOverlay;
00100         TTButton *_redoSearchInMapAreaButton;
00101         
00102         // Holds typeahead results for location
00103         UITableView *_overlayTable;
00104         
00105         EMSearchTextField *_keywordTextField, *_locationTextField, *_titleViewTextField;
00106         UILabel *_keyLeftViewLabel;
00107         UIToolbar *_searchToolbar;
00108         UIView *_searchBarContainer;
00109         
00110         EMLoadingView *loadingView;
00111         NSDate *_startLoad;
00112         
00113         NSString *_keywordString, *_locationString;
00114         
00115         UIBarButtonItem *_listMapToggle, *_cancelButton, *_filterButton, *_textFieldBarButtonItem, *_flexPad;
00116         EMStoreListTableView *_storeListTableView;
00117     
00118         //DEFAULT IS NO WHICH WILL FLIP FROM MAP TO TABLE
00119     //YES FLIPS FROM TABLE TO MAP
00120         BOOL _listMapBool;
00121         // Using enumerators that we expect to be 0 or 1 and then doing math... should review with rkuo
00122         EMStoreLocatorSearchFieldOption _viewKeyboardAndLocationOption;
00123         EMSearchTextFieldLocationOption _searchOnNavBar;
00124         
00125         //Query Booleans
00126         BOOL _currentLocation, _currentMapArea;
00127         
00128         //Location Access
00129         BOOL _locationDenied;
00130         
00131         //Determine who is moving map, either programatically or user
00132         BOOL _programaticPan;
00133         //There are two calls to mapView region did change while initializing and
00134         //loading the view, the temporary solution to get
00135         //around this problem is a _hitTest that is init to 0 
00136         //and when >1 allows the desired function of mapView region did change
00137         //to take place
00138         //TODO:The container view should intercept user touch events and pass them
00139         //to the mapView.
00140         NSInteger _hitTest;
00141         
00142         // Need to keep track of whether the map has loaded
00143         BOOL _mapLoaded, _dataLoaded;                                                                                                                   
00144         
00145         // Stores the last 20 locations that the user entered and used for location search typeahead
00146         // TODO: potentially write our own Most Recently Used array class?
00147         NSArray *_history;
00148         // Stores objects from the _history array that match the current location search text
00149         NSMutableArray *_locations;
00150         UIScrollView *echo_to;
00151         
00152         //Sort Stuff
00153         NSMutableArray *_sortOptions;
00154         NSArray *_userSettableSortOptions;
00155         EMSort *_defaultCurrentMapAreaSort;
00156         BOOL _showSortBarAlways;
00157         TTView *_sortBar;
00158         UISegmentedControl *_sortControl;
00159         
00160         BOOL _showFilterButton;
00161 }
00162 
00163 @property (nonatomic, assign) CGFloat searchRadius;
00164 @property (nonatomic, retain) NSString *geoFilterProperty;
00165 @property (nonatomic, retain) EMSearchQueryDataSource *dataSource;
00166 @property (nonatomic, retain) NSArray *sortOptions;
00167 @property (nonatomic, copy) EMSort *defaultCurrentMapAreaSort;
00168 @property (nonatomic, assign) BOOL showFilterButton;
00169 @property (nonatomic, retain) MKMapView *mapView;
00170 @property (nonatomic, retain) EMStoreListTableView *storeListTableView;
00171 
00172 
00173 - (id) initWithOption:(EMStoreLocatorSearchFieldOption)option;
00174 
00175 
00176 @end
00177