ios: Some view management cleanup
This commit is contained in:
parent
1fbe66cad0
commit
a4dd4e4463
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
extern NSString *const GSEventKeyDownNotification;
|
extern NSString* const GSEventKeyDownNotification;
|
||||||
extern NSString *const GSEventKeyUpNotification;
|
extern NSString* const GSEventKeyUpNotification;
|
||||||
|
|
||||||
@interface RetroArch_iOS : UIResponder <UIApplicationDelegate>
|
@interface RetroArch_iOS : UIResponder <UIApplicationDelegate>
|
||||||
|
|
||||||
|
@ -16,12 +16,13 @@ extern NSString *const GSEventKeyUpNotification;
|
||||||
- (void)runGame:(NSString*)path;
|
- (void)runGame:(NSString*)path;
|
||||||
- (void)gameHasExited;
|
- (void)gameHasExited;
|
||||||
|
|
||||||
|
- (void)pushViewController:(UIViewController*)theView;
|
||||||
|
- (void)popViewController;
|
||||||
|
|
||||||
@property (strong, nonatomic) NSString* system_directory;
|
@property (strong, nonatomic) NSString* system_directory;
|
||||||
@property (strong, nonatomic) NSString* config_file_path;
|
@property (strong, nonatomic) NSString* config_file_path;
|
||||||
|
|
||||||
@property (strong, nonatomic) UIWindow *window;
|
@property (strong, nonatomic) NSString* module_path;
|
||||||
@property (strong, nonatomic) NSString *module_path;
|
|
||||||
@property (strong, nonatomic) UINavigationController *navigator;
|
|
||||||
@property (strong, nonatomic) UIImage* file_icon;
|
@property (strong, nonatomic) UIImage* file_icon;
|
||||||
@property (strong, nonatomic) UIImage* folder_icon;
|
@property (strong, nonatomic) UIImage* folder_icon;
|
||||||
@property (strong, nonatomic) UIBarButtonItem* settings_button;
|
@property (strong, nonatomic) UIBarButtonItem* settings_button;
|
||||||
|
|
|
@ -23,6 +23,9 @@ extern uint32_t ios_current_touch_count;
|
||||||
@implementation RetroArch_iOS
|
@implementation RetroArch_iOS
|
||||||
{
|
{
|
||||||
game_view* game;
|
game_view* game;
|
||||||
|
|
||||||
|
UIWindow* window;
|
||||||
|
UINavigationController* navigator;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (RetroArch_iOS*)get
|
+ (RetroArch_iOS*)get
|
||||||
|
@ -33,18 +36,34 @@ extern uint32_t ios_current_touch_count;
|
||||||
- (void)runGame:(NSString*)path
|
- (void)runGame:(NSString*)path
|
||||||
{
|
{
|
||||||
game = [[game_view alloc] initWithGame:path];
|
game = [[game_view alloc] initWithGame:path];
|
||||||
self.window.rootViewController = game;
|
window.rootViewController = game;
|
||||||
self.navigator = nil;
|
navigator = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)gameHasExited
|
- (void)gameHasExited
|
||||||
{
|
{
|
||||||
game = nil;
|
game = nil;
|
||||||
|
|
||||||
self.navigator = [[UINavigationController alloc] init];
|
navigator = [[UINavigationController alloc] init];
|
||||||
[self.navigator pushViewController: [[module_list alloc] init] animated:YES];
|
[navigator pushViewController: [[module_list alloc] init] animated:YES];
|
||||||
|
|
||||||
self.window.rootViewController = self.navigator;
|
window.rootViewController = navigator;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)pushViewController:(UIViewController*)theView
|
||||||
|
{
|
||||||
|
if (navigator != nil)
|
||||||
|
{
|
||||||
|
[navigator pushViewController:theView animated:YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)popViewController
|
||||||
|
{
|
||||||
|
if (navigator != nil)
|
||||||
|
{
|
||||||
|
[navigator popViewControllerAnimated:YES];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(UIApplication *)application
|
- (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||||
|
@ -68,12 +87,12 @@ extern uint32_t ios_current_touch_count;
|
||||||
self.settings_button.action = @selector(show_settings);
|
self.settings_button.action = @selector(show_settings);
|
||||||
|
|
||||||
// Setup window
|
// Setup window
|
||||||
self.navigator = [[UINavigationController alloc] init];
|
navigator = [[UINavigationController alloc] init];
|
||||||
[self.navigator pushViewController: [[module_list alloc] init] animated:YES];
|
[navigator pushViewController: [[module_list alloc] init] animated:YES];
|
||||||
|
|
||||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||||
self.window.rootViewController = self.navigator;
|
window.rootViewController = navigator;
|
||||||
[self.window makeKeyAndVisible];
|
[window makeKeyAndVisible];
|
||||||
|
|
||||||
// Setup keyboard hack
|
// Setup keyboard hack
|
||||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyPressed:) name: GSEventKeyDownNotification object: nil];
|
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyPressed:) name: GSEventKeyDownNotification object: nil];
|
||||||
|
@ -110,7 +129,7 @@ extern uint32_t ios_current_touch_count;
|
||||||
|
|
||||||
- (void)show_settings
|
- (void)show_settings
|
||||||
{
|
{
|
||||||
[self.navigator pushViewController: [[SettingsList alloc] init] animated:YES];
|
[self pushViewController:[SettingsList new]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)processTouches:(NSArray*)touches
|
- (void)processTouches:(NSArray*)touches
|
||||||
|
|
|
@ -57,9 +57,7 @@ static BOOL is_directory(NSString* path)
|
||||||
|
|
||||||
if(is_directory(path))
|
if(is_directory(path))
|
||||||
{
|
{
|
||||||
[[RetroArch_iOS get].navigator
|
[[RetroArch_iOS get] pushViewController:[[directory_list alloc] initWithPath:path]];
|
||||||
pushViewController:[[directory_list alloc] initWithPath:path]
|
|
||||||
animated:YES];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void display_error_alert(NSString* message)
|
||||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
{
|
{
|
||||||
[RetroArch_iOS get].module_path = [modules objectAtIndex:indexPath.row];
|
[RetroArch_iOS get].module_path = [modules objectAtIndex:indexPath.row];
|
||||||
[[RetroArch_iOS get].navigator pushViewController:[[directory_list alloc] initWithPath:nil] animated:YES];
|
[[RetroArch_iOS get] pushViewController:[[directory_list alloc] initWithPath:nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
value.value = @"";
|
value.value = @"";
|
||||||
|
|
||||||
[view reloadData];
|
[view reloadData];
|
||||||
[[RetroArch_iOS get].navigator popViewControllerAnimated:YES];
|
[[RetroArch_iOS get] popViewController];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -66,9 +66,7 @@ static const char* const SETTINGID = "SETTING";
|
||||||
{
|
{
|
||||||
case EnumerationSetting:
|
case EnumerationSetting:
|
||||||
case FileListSetting:
|
case FileListSetting:
|
||||||
[[RetroArch_iOS get].navigator
|
[[RetroArch_iOS get] pushViewController:[[SettingEnumerationList alloc] initWithSetting:setting fromTable:(UITableView*)self.view]];
|
||||||
pushViewController:[[SettingEnumerationList alloc] initWithSetting:setting fromTable:(UITableView*)self.view]
|
|
||||||
animated:YES];
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonSetting:
|
case ButtonSetting:
|
||||||
|
@ -76,9 +74,7 @@ static const char* const SETTINGID = "SETTING";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GroupSetting:
|
case GroupSetting:
|
||||||
[[RetroArch_iOS get].navigator
|
[[RetroArch_iOS get] pushViewController:[[SettingsSubList alloc] initWithSettings:setting.subValues title:setting.label]];
|
||||||
pushViewController:[[SettingsSubList alloc] initWithSettings:setting.subValues title:setting.label]
|
|
||||||
animated:YES];
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue