Permalink
Browse files

adding popover controller. doesnt do anything yet

  • Loading branch information...
1 parent ddcb16f commit 57921c3d520831153a937016e0f910223bc9e289 @itod committed Apr 18, 2010
Showing with 207 additions and 3 deletions.
  1. +19 −3 UMEKit.xcodeproj/project.pbxproj
  2. +2 −0 include/UMEKit/UMEKit.h
  3. +122 −0 include/UMEKit/UMEPopoverController.h
  4. +64 −0 src/UMEPopoverController.m
@@ -23,6 +23,8 @@
D34341AA10743EE500C31EFA /* UMEInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = D34341A910743EE500C31EFA /* UMEInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };
D34342281074446C00C31EFA /* UMERedView.m in Sources */ = {isa = PBXBuildFile; fileRef = D34342261074446C00C31EFA /* UMERedView.m */; };
D343424B1074455900C31EFA /* UMEFlippedView.m in Sources */ = {isa = PBXBuildFile; fileRef = D34342491074455900C31EFA /* UMEFlippedView.m */; };
+ D350D2E3117BB25A00A21B6A /* UMEPopoverController.m in Sources */ = {isa = PBXBuildFile; fileRef = D350D2E1117BB25A00A21B6A /* UMEPopoverController.m */; };
+ D350D2F1117BB44200A21B6A /* UMEPopoverController.h in Headers */ = {isa = PBXBuildFile; fileRef = D350D2F0117BB44200A21B6A /* UMEPopoverController.h */; settings = {ATTRIBUTES = (Public, ); }; };
D35575B810867F000038982C /* MySecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D35575B510867EF60038982C /* MySecondViewController.m */; };
D35575BC10867F240038982C /* MyThirdViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D35575BB10867F240038982C /* MyThirdViewController.m */; };
D39BF34F1087028800E399F3 /* UMEDebugView.m in Sources */ = {isa = PBXBuildFile; fileRef = D39BF34D1087028800E399F3 /* UMEDebugView.m */; };
@@ -198,6 +200,8 @@
D34342261074446C00C31EFA /* UMERedView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UMERedView.m; path = src/UMERedView.m; sourceTree = "<group>"; };
D34342481074455900C31EFA /* UMEFlippedView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UMEFlippedView.h; path = src/UMEFlippedView.h; sourceTree = "<group>"; };
D34342491074455900C31EFA /* UMEFlippedView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UMEFlippedView.m; path = src/UMEFlippedView.m; sourceTree = "<group>"; };
+ D350D2E1117BB25A00A21B6A /* UMEPopoverController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UMEPopoverController.m; path = src/UMEPopoverController.m; sourceTree = "<group>"; };
+ D350D2F0117BB44200A21B6A /* UMEPopoverController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UMEPopoverController.h; path = include/UMEKit/UMEPopoverController.h; sourceTree = "<group>"; };
D35575B410867EF60038982C /* MySecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MySecondViewController.h; path = demoapp/MySecondViewController.h; sourceTree = "<group>"; };
D35575B510867EF60038982C /* MySecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MySecondViewController.m; path = demoapp/MySecondViewController.m; sourceTree = "<group>"; };
D35575BA10867F240038982C /* MyThirdViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MyThirdViewController.h; path = demoapp/MyThirdViewController.h; sourceTree = "<group>"; };
@@ -405,8 +409,7 @@
08FB77AEFE84172EC02AAC07 /* UMEKit Framework */ = {
isa = PBXGroup;
children = (
- D3EB8C4F117A65EE003C4A2E /* UMEToolbar.h */,
- D3EB8C4D117A65D8003C4A2E /* UMEToolbar.m */,
+ D350D2DF117BB24900A21B6A /* Popover */,
D3DEC16B10700D50006B582A /* UMEViewController.h */,
D3DEC10E1070062E006B582A /* UMEViewController.m */,
D3DEC19810700DE7006B582A /* UMENavigationController.h */,
@@ -419,6 +422,8 @@
D3DEC1B310701123006B582A /* UMETabBarController.m */,
D3DEC1BB1070114D006B582A /* UMETabBar.h */,
D3DEC1B71070112F006B582A /* UMETabBar.m */,
+ D3EB8C4F117A65EE003C4A2E /* UMEToolbar.h */,
+ D3EB8C4D117A65D8003C4A2E /* UMEToolbar.m */,
D3CF41D61090076C0035F42A /* UMEBarItem.h */,
D3CF41D3109002EB0035F42A /* UMEBarItem.m */,
D306BB66109169C00011DE1B /* BarButtonItem */,
@@ -507,12 +512,21 @@
name = DemoApp;
sourceTree = "<group>";
};
+ D350D2DF117BB24900A21B6A /* Popover */ = {
+ isa = PBXGroup;
+ children = (
+ D350D2F0117BB44200A21B6A /* UMEPopoverController.h */,
+ D350D2E1117BB25A00A21B6A /* UMEPopoverController.m */,
+ );
+ name = Popover;
+ sourceTree = "<group>";
+ };
D3C3B251108562DA00ED4547 /* Internal */ = {
isa = PBXGroup;
children = (
+ D3DEC19C10700E10006B582A /* UMEKit.h */,
D34342481074455900C31EFA /* UMEFlippedView.h */,
D34342491074455900C31EFA /* UMEFlippedView.m */,
- D3DEC19C10700E10006B582A /* UMEKit.h */,
D34342251074446C00C31EFA /* UMERedView.h */,
D34342261074446C00C31EFA /* UMERedView.m */,
D39BF34C1087028800E399F3 /* UMEDebugView.h */,
@@ -666,6 +680,7 @@
D3E571FD109125E500810BCD /* UMEActivityBarButtonItemButtonCell.h in Headers */,
D306BB6B10916A3A0011DE1B /* UMETabBarItemButtonCell.h in Headers */,
D3EB8C50117A65EE003C4A2E /* UMEToolbar.h in Headers */,
+ D350D2F1117BB44200A21B6A /* UMEPopoverController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -873,6 +888,7 @@
D3E571FC109125E500810BCD /* UMEActivityBarButtonItemButtonCell.m in Sources */,
D306BB6A10916A3A0011DE1B /* UMETabBarItemButtonCell.m in Sources */,
D3EB8C4E117A65D8003C4A2E /* UMEToolbar.m in Sources */,
+ D350D2E3117BB25A00A21B6A /* UMEPopoverController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -19,6 +19,8 @@
#import <UMEKit/UMEToolBar.h>
+#import <UMEKit/UMEPopoverController.h>
+
#import <UMEKit/UMENavigationController.h>
#import <UMEKit/UMENavigationBar.h>
#import <UMEKit/UMENavigationItem.h>
@@ -0,0 +1,122 @@
+// Copyright 2010 Todd Ditchendorf
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#import <Cocoa/Cocoa.h>
+//#import <CoreGraphics/CoreGraphics.h>
+//#import <UMEKit/UMEKitDefines.h>
+#import <UMEKit/UMEViewController.h>
+
+@class UMEBarButtonItem, UMEView;
+@protocol UMEPopoverControllerDelegate;
+
+typedef enum NSUInteger {
+ UMEPopoverArrowDirectionUp = 1UL << 0,
+ UMEPopoverArrowDirectionDown = 1UL << 1,
+ UMEPopoverArrowDirectionLeft = 1UL << 2,
+ UMEPopoverArrowDirectionRight = 1UL << 3,
+ UMEPopoverArrowDirectionAny = UMEPopoverArrowDirectionUp | UMEPopoverArrowDirectionDown | UMEPopoverArrowDirectionLeft | UMEPopoverArrowDirectionRight,
+ UMEPopoverArrowDirectionUnknown = NSUIntegerMax
+} UMEPopoverArrowDirection;
+
+@interface UMEPopoverController : NSObject {
+@private
+ id delegate;
+ UMEViewController *contentViewController;
+ NSView *popoverView;
+ NSArray *passthroughViews;
+ UMEPopoverArrowDirection popoverArrowDirection;
+ NSUInteger popoverBackgroundStyle;
+ CGSize popoverContentSize;
+ UMEBarButtonItem *targetBarButtonItem;
+ NSUInteger toViewAutoResizingMask;
+ UMEViewController *modalPresentationFromViewController;
+ UMEViewController *modalPresentationToViewController;
+ UMEViewController *slidingViewController;
+ id target;
+ SEL didEndSelector;
+// struct {
+// unsigned int isPresentingOrDismissing:1;
+// unsigned int isPresentingModalViewController:1;
+// unsigned int isPresentingActionSheet:1;
+// unsigned int needsRepresentAfterRotation:1;
+// unsigned int dimsWhenModal:1;
+// } _popoverControllerFlags;
+}
+
+/* The view controller provided becomes the content view controller for the UMEPopoverController. This is the designated initializer for UMEPopoverController.
+ */
+- (id)initWithContentViewController:(UMEViewController *)viewController;
+
+@property (nonatomic, assign) id <UMEPopoverControllerDelegate> delegate;
+
+/* The content view controller is the `UMEViewController` instance in charge of the content view of the displayed popover. This property can be changed while the popover is displayed to allow different view controllers in the same popover session.
+ */
+@property (nonatomic, retain) UMEViewController *contentViewController;
+- (void)setContentViewController:(UMEViewController *)viewController animated:(BOOL)animated;
+
+/* This property allows direction manipulation of the content size of the popover. Changing the property directly is equivalent to animated=YES. The content size is limited to a minimum width of 320 and a maximum width of 600.
+ */
+@property (nonatomic) CGSize popoverContentSize;
+- (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated;
+
+/* Returns whether the popover is visible (presented) or not.
+ */
+@property (nonatomic, readonly, getter=isPopoverVisible) BOOL popoverVisible;
+
+/* Returns the direction the arrow is pointing on a presented popover. Before presentation, this returns UMEPopoverArrowDirectionUnknown.
+ */
+@property (nonatomic, readonly) UMEPopoverArrowDirection popoverArrowDirection;
+
+/* By default, a popover disallows interaction with any view outside of the popover while the popover is presented. This property allows the specification of an array of UMEView instances which the user is allowed to interact with while the popover is up.
+ */
+@property (nonatomic, copy) NSArray *passthroughViews;
+
+/* -presentPopoverFromRect:inView:permittedArrowDirections:animated: allows you to present a popover from a rect in a particular view. `arrowDirections` is a bitfield which specifies what arrow directions are allowed when laying out the popover; for most uses, `UMEPopoverArrowDirectionAny` is sufficient.
+ */
+- (void)presentPopoverFromRect:(CGRect)rect inView:(UMEView *)view permittedArrowDirections:(UMEPopoverArrowDirection)arrowDirections animated:(BOOL)animated;
+
+/* Like the above, but is a convenience for presentation from a `UMEBarButtonItem` instance. arrowDirection limited to UMEPopoverArrowDirectionUp/Down
+ */
+- (void)presentPopoverFromBarButtonItem:(UMEBarButtonItem *)item permittedArrowDirections:(UMEPopoverArrowDirection)arrowDirections animated:(BOOL)animated;
+
+/* Called to dismiss the popover programmatically. The delegate methods for "should" and "did" dismiss are not called when the popover is dismissed in this way.
+ */
+- (void)dismissPopoverAnimated:(BOOL)animated;
+
+@end
+
+@protocol UMEPopoverControllerDelegate <NSObject>
+@optional
+
+/* Called on the delegate when the popover controller will dismiss the popover. Return NO to prevent the dismissal of the view.
+ */
+- (BOOL)popoverControllerShouldDismissPopover:(UMEPopoverController *)popoverController;
+
+/* Called on the delegate when the user has taken action to dismiss the popover. This is not called when -dismissPopoverAnimated: is called directly.
+ */
+- (void)popoverControllerDidDismissPopover:(UMEPopoverController *)popoverController;
+
+@end
+
+@interface UMEViewController (UMEPopoverController)
+
+/* contentSizeForViewInPopover allows you to set the size of the content from within the view controller. This property is read/write, and you should generally not override it.
+ */
+@property (nonatomic,readwrite) CGSize contentSizeForViewInPopover;
+
+/* modalInPopover is set on the view controller when you wish to force the popover hosting the view controller into modal behavior. When this is active, the popover will ignore events outside of its bounds until this is set to NO.
+ */
+@property (nonatomic,readwrite,getter=isModalInPopover) BOOL modalInPopover;
+
+@end
View
@@ -0,0 +1,64 @@
+//
+// UMEPopoverController.m
+// UMEKit
+//
+// Created by Todd Ditchendorf on 4/18/10.
+// Copyright 2010 Todd Ditchendorf. All rights reserved.
+//
+
+#import "UMEPopoverController.h"
+
+
+@implementation UMEPopoverController
+
+- (id)initWithContentViewController:(UMEViewController *)viewController {
+ if (self = [super init]) {
+
+ }
+ return self;
+}
+
+
+- (void)dealloc {
+
+ [super dealloc];
+}
+
+
+
+@synthesize delegate;
+
+@synthesize contentViewController;
+- (void)setContentViewController:(UMEViewController *)viewController animated:(BOOL)animated {
+
+}
+
+@synthesize popoverContentSize;
+- (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated {
+
+}
+@synthesize popoverVisible;
+@synthesize popoverArrowDirection;
+@synthesize passthroughViews;
+
+
+- (void)presentPopoverFromRect:(CGRect)rect inView:(UMEView *)view permittedArrowDirections:(UMEPopoverArrowDirection)arrowDirections animated:(BOOL)animated {
+
+}
+
+
+- (void)presentPopoverFromBarButtonItem:(UMEBarButtonItem *)item permittedArrowDirections:(UMEPopoverArrowDirection)arrowDirections animated:(BOOL)animated {
+
+}
+
+
+- (void)dismissPopoverAnimated:(BOOL)animated {
+
+}
+
+@end
+
+//@implementation UMEViewController (UMEPopoverController)
+//@synthesize contentSizeForViewInPopover;
+//@synthesize modalInPopover;
+//@end

0 comments on commit 57921c3

Please sign in to comment.