(iOS) Move some iOS-specific code over to cocoatouch_menu.m

This commit is contained in:
Twinaphex 2015-04-21 04:03:36 +02:00
parent 4b63cb54c9
commit 151b1ea391
2 changed files with 100 additions and 98 deletions

View File

@ -34,10 +34,7 @@
#include <CoreLocation/CoreLocation.h>
#import <AVFoundation/AVCaptureOutput.h>
@protocol RAMenuItemBase
- (UITableViewCell*)cellForTableView:(UITableView*)tableView;
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller;
@end
/*********************************************/
/* RAMenuBase */
@ -53,100 +50,6 @@
@end
/*********************************************/
/* RAMenuItemBasic */
/* A simple menu item that displays a text */
/* description and calls a block object when */
/* selected. */
/*********************************************/
@interface RAMenuItemBasic : NSObject<RAMenuItemBase>
@property (nonatomic) NSString* description;
@property (nonatomic) id userdata;
@property (copy) void (^action)(id userdata);
@property (copy) NSString* (^detail)(id userdata);
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action;
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action detail:(NSString* (^)())detail;
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description association:(id)userdata action:(void (^)())action detail:(NSString* (^)())detail;
@end
/*********************************************/
/* RAMenuItemGeneralSetting */
/* A simple menu item that displays the */
/* state, and allows editing, of a string or */
/* numeric setting. */
/*********************************************/
@interface RAMenuItemGeneralSetting : NSObject<RAMenuItemBase>
@property (nonatomic) rarch_setting_t* setting;
@property (copy) void (^action)();
@property (nonatomic, weak) UITableView* parentTable;
+ (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action;
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
@end
/*********************************************/
/* RAMenuItemBooleanSetting */
/* A simple menu item that displays the */
/* state, and allows editing, of a boolean */
/* setting. */
/*********************************************/
@interface RAMenuItemBooleanSetting : NSObject<RAMenuItemBase>
@property (nonatomic) rarch_setting_t* setting;
@property (copy) void (^action)();
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
@end
/*********************************************/
/* RAMenuItemPathSetting */
/* A menu item that displays and allows */
/* browsing for a path setting. */
/*********************************************/
@interface RAMenuItemPathSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMenuItemEnumSetting */
/* A menu item that displays and allows */
/* a setting to be set from a list of */
/* allowed choices. */
/*********************************************/
@interface RAMenuItemEnumSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMenuItemBindSetting */
/* A menu item that displays and allows */
/* mapping of a keybinding. */
/*********************************************/
@interface RAMenuItemBindSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMainMenu */
/* Menu object that is displayed immediately */
/* after startup. */
/*********************************************/
@interface RAMainMenu : RAMenuBase
@property (nonatomic) NSString* core;
@end
@interface RADirectoryItem : NSObject<RAMenuItemBase>
@property (nonatomic) NSString* path;
@property (nonatomic) bool isDirectory;
@end
@interface RADirectoryList : RAMenuBase<UIActionSheetDelegate>
@property (nonatomic, weak) RADirectoryItem* selectedItem;
@property (nonatomic, copy) void (^chooseAction)(RADirectoryList* list, RADirectoryItem* item);
@property (nonatomic, copy) NSString* path;
@property (nonatomic, copy) NSString* extensions;
@property (nonatomic) bool allowBlank;
@property (nonatomic) bool forDirectory;
- (id)initWithPath:(NSString*)path extensions:(const char*)extensions action:(void (^)(RADirectoryList* list, RADirectoryItem* item))action;
- (void)browseTo:(NSString*)path;
@end
@interface RAFoldersList : RAMenuBase
- (id) initWithFilePath:(NSString*)path;
@end

View File

@ -27,6 +27,105 @@
#include "../../../menu/menu_entries.h"
#include "../../../menu/drivers/shared.h"
@protocol RAMenuItemBase
- (UITableViewCell*)cellForTableView:(UITableView*)tableView;
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller;
@end
/*********************************************/
/* RAMenuItemBasic */
/* A simple menu item that displays a text */
/* description and calls a block object when */
/* selected. */
/*********************************************/
@interface RAMenuItemBasic : NSObject<RAMenuItemBase>
@property (nonatomic) NSString* description;
@property (nonatomic) id userdata;
@property (copy) void (^action)(id userdata);
@property (copy) NSString* (^detail)(id userdata);
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action;
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description action:(void (^)())action detail:(NSString* (^)())detail;
+ (RAMenuItemBasic*)itemWithDescription:(NSString*)description association:(id)userdata action:(void (^)())action detail:(NSString* (^)())detail;
@end
/*********************************************/
/* RAMenuItemGeneralSetting */
/* A simple menu item that displays the */
/* state, and allows editing, of a string or */
/* numeric setting. */
/*********************************************/
@interface RAMenuItemGeneralSetting : NSObject<RAMenuItemBase>
@property (nonatomic) rarch_setting_t* setting;
@property (copy) void (^action)();
@property (nonatomic, weak) UITableView* parentTable;
+ (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action;
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
@end
/*********************************************/
/* RAMenuItemBooleanSetting */
/* A simple menu item that displays the */
/* state, and allows editing, of a boolean */
/* setting. */
/*********************************************/
@interface RAMenuItemBooleanSetting : NSObject<RAMenuItemBase>
@property (nonatomic) rarch_setting_t* setting;
@property (copy) void (^action)();
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
@end
/*********************************************/
/* RAMenuItemPathSetting */
/* A menu item that displays and allows */
/* browsing for a path setting. */
/*********************************************/
@interface RAMenuItemPathSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMenuItemEnumSetting */
/* A menu item that displays and allows */
/* a setting to be set from a list of */
/* allowed choices. */
/*********************************************/
@interface RAMenuItemEnumSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMenuItemBindSetting */
/* A menu item that displays and allows */
/* mapping of a keybinding. */
/*********************************************/
@interface RAMenuItemBindSetting : RAMenuItemGeneralSetting<RAMenuItemBase> @end
/*********************************************/
/* RAMainMenu */
/* Menu object that is displayed immediately */
/* after startup. */
/*********************************************/
@interface RAMainMenu : RAMenuBase
@property (nonatomic) NSString* core;
@end
@interface RADirectoryItem : NSObject<RAMenuItemBase>
@property (nonatomic) NSString* path;
@property (nonatomic) bool isDirectory;
@end
@interface RADirectoryList : RAMenuBase<UIActionSheetDelegate>
@property (nonatomic, weak) RADirectoryItem* selectedItem;
@property (nonatomic, copy) void (^chooseAction)(RADirectoryList* list, RADirectoryItem* item);
@property (nonatomic, copy) NSString* path;
@property (nonatomic, copy) NSString* extensions;
@property (nonatomic) bool allowBlank;
@property (nonatomic) bool forDirectory;
- (id)initWithPath:(NSString*)path extensions:(const char*)extensions action:(void (^)(RADirectoryList* list, RADirectoryItem* item))action;
- (void)browseTo:(NSString*)path;
@end
@interface RANumberFormatter : NSNumberFormatter<UITextFieldDelegate>
- (id)initWithSetting:(const rarch_setting_t*)setting;