project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitViewController.h
changeset 8441 a00b0fa0dbd7
parent 6659 a6030b32b222
child 11115 3729ac42189b
equal deleted inserted replaced
8440:ea4d6a7a2937 8441:a00b0fa0dbd7
     7 //
     7 //
     8 
     8 
     9 #import <UIKit/UIKit.h>
     9 #import <UIKit/UIKit.h>
    10 
    10 
    11 typedef enum _MGSplitViewDividerStyle {
    11 typedef enum _MGSplitViewDividerStyle {
    12 	// These names have been chosen to be conceptually similar to those of NSSplitView on Mac OS X.
    12     // These names have been chosen to be conceptually similar to those of NSSplitView on Mac OS X.
    13 	MGSplitViewDividerStyleThin			= 0, // Thin divider, like UISplitViewController (default).
    13     MGSplitViewDividerStyleThin         = 0, // Thin divider, like UISplitViewController (default).
    14 	MGSplitViewDividerStylePaneSplitter	= 1  // Thick divider, drawn with a grey gradient and a grab-strip.
    14     MGSplitViewDividerStylePaneSplitter = 1  // Thick divider, drawn with a grey gradient and a grab-strip.
    15 } MGSplitViewDividerStyle;
    15 } MGSplitViewDividerStyle;
    16 
    16 
    17 @class MGSplitDividerView;
    17 @class MGSplitDividerView;
    18 @protocol MGSplitViewControllerDelegate;
    18 @protocol MGSplitViewControllerDelegate;
    19 @interface MGSplitViewController : UIViewController <UIPopoverControllerDelegate> {
    19 @interface MGSplitViewController : UIViewController <UIPopoverControllerDelegate> {
    20 	BOOL _showsMasterInPortrait;
    20     BOOL _showsMasterInPortrait;
    21 	BOOL _showsMasterInLandscape;
    21     BOOL _showsMasterInLandscape;
    22 	float _splitWidth;
    22     float _splitWidth;
    23 	id _delegate;
    23     id _delegate;
    24 	BOOL _vertical;
    24     BOOL _vertical;
    25 	BOOL _masterBeforeDetail;
    25     BOOL _masterBeforeDetail;
    26 	NSMutableArray *_viewControllers;
    26     NSMutableArray *_viewControllers;
    27 	UIBarButtonItem *_barButtonItem; // To be compliant with wacky UISplitViewController behaviour.
    27     UIBarButtonItem *_barButtonItem; // To be compliant with wacky UISplitViewController behaviour.
    28     UIPopoverController *_hiddenPopoverController; // Popover used to hold the master view if it's not always visible.
    28     UIPopoverController *_hiddenPopoverController; // Popover used to hold the master view if it's not always visible.
    29 	MGSplitDividerView *_dividerView; // View that draws the divider between the master and detail views.
    29     MGSplitDividerView *_dividerView; // View that draws the divider between the master and detail views.
    30 	NSArray *_cornerViews; // Views to draw the inner rounded corners between master and detail views.
    30     NSArray *_cornerViews; // Views to draw the inner rounded corners between master and detail views.
    31 	float _splitPosition;
    31     float _splitPosition;
    32 	BOOL _reconfigurePopup;
    32     BOOL _reconfigurePopup;
    33 	MGSplitViewDividerStyle _dividerStyle; // Meta-setting which configures several aspects of appearance and behaviour.
    33     MGSplitViewDividerStyle _dividerStyle; // Meta-setting which configures several aspects of appearance and behaviour.
    34 }
    34 }
    35 
    35 
    36 @property (nonatomic, assign) IBOutlet id <MGSplitViewControllerDelegate> delegate;
    36 @property (nonatomic, assign) IBOutlet id <MGSplitViewControllerDelegate> delegate;
    37 @property (nonatomic, assign) BOOL showsMasterInPortrait; // applies to both portrait orientations (default NO)
    37 @property (nonatomic, assign) BOOL showsMasterInPortrait; // applies to both portrait orientations (default NO)
    38 @property (nonatomic, assign) BOOL showsMasterInLandscape; // applies to both landscape orientations (default YES)
    38 @property (nonatomic, assign) BOOL showsMasterInLandscape; // applies to both landscape orientations (default YES)
    58 - (void)notePopoverDismissed; // should rarely be needed, because you should not change the popover's delegate. If you must, then call this when it's dismissed.
    58 - (void)notePopoverDismissed; // should rarely be needed, because you should not change the popover's delegate. If you must, then call this when it's dismissed.
    59 
    59 
    60 // Conveniences for you, because I care.
    60 // Conveniences for you, because I care.
    61 - (BOOL)isShowingMaster;
    61 - (BOOL)isShowingMaster;
    62 - (void)setSplitPosition:(float)posn animated:(BOOL)animate; // Allows for animation of splitPosition changes. The property's regular setter is not animated.
    62 - (void)setSplitPosition:(float)posn animated:(BOOL)animate; // Allows for animation of splitPosition changes. The property's regular setter is not animated.
    63 /* Note:	splitPosition is the width (in a left/right split, or height in a top/bottom split) of the master view.
    63 /* Note:    splitPosition is the width (in a left/right split, or height in a top/bottom split) of the master view.
    64 			It is relative to the appropriate side of the splitView, which can be any of the four sides depending on the values in isMasterBeforeDetail and isVertical:
    64             It is relative to the appropriate side of the splitView, which can be any of the four sides depending on the values in isMasterBeforeDetail and isVertical:
    65 				isVertical = YES, isMasterBeforeDetail = YES: splitPosition is relative to the LEFT edge. (Default)
    65                 isVertical = YES, isMasterBeforeDetail = YES: splitPosition is relative to the LEFT edge. (Default)
    66 				isVertical = YES, isMasterBeforeDetail = NO: splitPosition is relative to the RIGHT edge.
    66                 isVertical = YES, isMasterBeforeDetail = NO: splitPosition is relative to the RIGHT edge.
    67  				isVertical = NO, isMasterBeforeDetail = YES: splitPosition is relative to the TOP edge.
    67                 isVertical = NO, isMasterBeforeDetail = YES: splitPosition is relative to the TOP edge.
    68  				isVertical = NO, isMasterBeforeDetail = NO: splitPosition is relative to the BOTTOM edge.
    68                 isVertical = NO, isMasterBeforeDetail = NO: splitPosition is relative to the BOTTOM edge.
    69 
    69 
    70 			This implementation was chosen so you don't need to recalculate equivalent splitPositions if the user toggles masterBeforeDetail themselves.
    70             This implementation was chosen so you don't need to recalculate equivalent splitPositions if the user toggles masterBeforeDetail themselves.
    71  */
    71  */
    72 - (void)setDividerStyle:(MGSplitViewDividerStyle)newStyle animated:(BOOL)animate; // Allows for animation of dividerStyle changes. The property's regular setter is not animated.
    72 - (void)setDividerStyle:(MGSplitViewDividerStyle)newStyle animated:(BOOL)animate; // Allows for animation of dividerStyle changes. The property's regular setter is not animated.
    73 - (NSArray *)cornerViews;
    73 - (NSArray *)cornerViews;
    74 /*
    74 /*
    75  -cornerViews returns an NSArray of two MGSplitCornersView objects, used to draw the inner corners.
    75  -cornerViews returns an NSArray of two MGSplitCornersView objects, used to draw the inner corners.
    76  The first view is the "leading" corners (top edge of screen for left/right split, left edge of screen for top/bottom split).
    76  The first view is the "leading" corners (top edge of screen for left/right split, left edge of screen for top/bottom split).
    77  The second view is the "trailing" corners (bottom edge of screen for left/right split, right edge of screen for top/bottom split).
    77  The second view is the "trailing" corners (bottom edge of screen for left/right split, right edge of screen for top/bottom split).
    78  Do NOT modify them, except to:
    78  Do NOT modify them, except to:
    79 	1. Change their .cornerBackgroundColor
    79     1. Change their .cornerBackgroundColor
    80 	2. Change their .cornerRadius
    80     2. Change their .cornerRadius
    81  */
    81  */
    82 
    82 
    83 @end
    83 @end
    84 
    84 
    85 
    85 
    86 @protocol MGSplitViewControllerDelegate
    86 @protocol MGSplitViewControllerDelegate
    87 
    87 
    88 @optional
    88 @optional
    89 
    89 
    90 // Called when a button should be added to a toolbar for a hidden view controller.
    90 // Called when a button should be added to a toolbar for a hidden view controller.
    91 - (void)splitViewController:(MGSplitViewController*)svc 
    91 - (void)splitViewController:(MGSplitViewController*)svc
    92 	 willHideViewController:(UIViewController *)aViewController 
    92      willHideViewController:(UIViewController *)aViewController
    93 		  withBarButtonItem:(UIBarButtonItem*)barButtonItem 
    93           withBarButtonItem:(UIBarButtonItem*)barButtonItem
    94 	   forPopoverController: (UIPopoverController*)pc;
    94        forPopoverController: (UIPopoverController*)pc;
    95 
    95 
    96 // Called when the master view is shown again in the split view, invalidating the button and popover controller.
    96 // Called when the master view is shown again in the split view, invalidating the button and popover controller.
    97 - (void)splitViewController:(MGSplitViewController*)svc 
    97 - (void)splitViewController:(MGSplitViewController*)svc
    98 	 willShowViewController:(UIViewController *)aViewController 
    98      willShowViewController:(UIViewController *)aViewController
    99   invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem;
    99   invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem;
   100 
   100 
   101 // Called when the master view is shown in a popover, so the delegate can take action like hiding other popovers.
   101 // Called when the master view is shown in a popover, so the delegate can take action like hiding other popovers.
   102 - (void)splitViewController:(MGSplitViewController*)svc 
   102 - (void)splitViewController:(MGSplitViewController*)svc
   103 		  popoverController:(UIPopoverController*)pc 
   103           popoverController:(UIPopoverController*)pc
   104   willPresentViewController:(UIViewController *)aViewController;
   104   willPresentViewController:(UIViewController *)aViewController;
   105 
   105 
   106 // Called when the split orientation will change (from vertical to horizontal, or vice versa).
   106 // Called when the split orientation will change (from vertical to horizontal, or vice versa).
   107 - (void)splitViewController:(MGSplitViewController*)svc willChangeSplitOrientationToVertical:(BOOL)isVertical;
   107 - (void)splitViewController:(MGSplitViewController*)svc willChangeSplitOrientationToVertical:(BOOL)isVertical;
   108 
   108