]> git.saurik.com Git - cydia.git/blobdiff - UICaboodle/RVBook.mm
Added a cool finish.sh script.
[cydia.git] / UICaboodle / RVBook.mm
index ccd3e426b0235d0ba9875a4c37675c36dc21f2ae..cef1acee62e297fb58d8ac6e6f68792f4753030b 100644 (file)
@@ -8,6 +8,14 @@
 #import <UIKit/UIView-Geometry.h>
 #import <UIKit/UIView-Hierarchy.h>
 
+#import <Foundation/Foundation.h>
+#import <CoreGraphics/CGGeometry.h>
+
+#include <cstdio>
+#include <cstdlib>
+
+#include <errno.h>
+
 #import "RVPage.h"
 
 @implementation RVBook
     [super dealloc];
 }
 
+- (UINavigationBar *) navigationBar {
+    return navbar_;
+}
+
 - (void) navigationBar:(UINavigationBar *)navbar buttonClicked:(int)button {
     _assert([pages_ count] != 0);
     RVPage *page = [pages_ lastObject];
@@ -44,7 +56,7 @@
         pages_ = [[NSMutableArray arrayWithCapacity:4] retain];
 
         struct CGRect bounds = [self bounds];
-        CGSize navsize = [UINavigationBar defaultSizeWithPrompt];
+        CGSize navsize = [UINavigationBar defaultSize];
         CGRect navrect = {{0, 0}, navsize};
 
         navbar_ = [[UINavigationBar alloc] initWithFrame:navrect];
@@ -53,8 +65,6 @@
         [navbar_ setBarStyle:0];
         [navbar_ setDelegate:self];
 
-        [navbar_ setPrompt:@""];
-
         transition_ = [[UITransitionView alloc] initWithFrame:CGRectMake(
             bounds.origin.x, bounds.origin.y + navsize.height, bounds.size.width, bounds.size.height - navsize.height
         )];
     [navbar_ pushNavigationItem:navitem];
 
     BOOL animated = [pages_ count] == 0 ? NO : YES;
+    [page setFrame:[transition_ bounds]];
     [transition_ transition:(animated ? 1 : 0) toView:page];
     [page setPageActive:YES];
 
     [pages_ addObject:page];
     [self reloadButtonsForPage:page];
 
-    if ([navbar_ respondsToSelector:@selector(setAccessoryView:animate:goingBack:)])
-        [navbar_ setAccessoryView:[page accessoryView] animate:animated goingBack:NO];
-    else
-        [navbar_ setAccessoryView:[page accessoryView] animate:animated removeOnPop:NO];
+    [navbar_ setAccessoryView:[page accessoryView] animate:animated removeOnPop:NO];
 }
 
 - (void) popPages:(unsigned)pages {
     [self resetViewAnimated:YES toPage:[pages_ lastObject]];
 }
 
-- (void) setPrompt:(NSString *)prompt {
-    [navbar_ setPrompt:prompt];
-}
-
 - (void) resetViewAnimated:(BOOL)animated {
     resetting_ = true;
 
 
 - (void) resetViewAnimated:(BOOL)animated toPage:(RVPage *)page {
     [page resetViewAnimated:animated];
+    [page setFrame:[transition_ bounds]];
     [transition_ transition:(animated ? 2 : 0) toView:page];
     [page setPageActive:YES];
     [self reloadButtonsForPage:page];
 
-    if ([navbar_ respondsToSelector:@selector(setAccessoryView:animate:goingBack:)])
-        [navbar_ setAccessoryView:[page accessoryView] animate:animated goingBack:YES];
-    else
-        [navbar_ setAccessoryView:[page accessoryView] animate:animated removeOnPop:NO];
+    [navbar_ setAccessoryView:[page accessoryView] animate:animated removeOnPop:NO];
 }
 
 - (void) setTitle:(NSString *)title forPage:(RVPage *)page {
 - (void) reloadButtonsForPage:(RVPage *)page {
     if ([pages_ count] == 0 || page != [pages_ lastObject])
         return;
-    NSString *leftButtonTitle([pages_ count] == 1 ? [page leftButtonTitle] : nil);
-    [navbar_ showButtonsWithLeftTitle:leftButtonTitle rightTitle:[page rightButtonTitle]];
+    NSString *leftButtonTitle([page leftButtonTitle]);
+    UINavigationButtonStyle leftButtonStyle = [page leftButtonStyle];
+    UINavigationButtonStyle rightButtonStyle = [page rightButtonStyle];
+    //[navbar_ showButtonsWithLeftTitle:leftButtonTitle rightTitle:[page rightButtonTitle] leftBack:(leftButtonTitle == nil)];
+
+    [navbar_
+        showLeftButton:leftButtonTitle
+        withStyle:leftButtonStyle
+        rightButton:[page rightButtonTitle]
+        withStyle:rightButtonStyle
+    ];
 }
 
 - (NSString *) getTitleForPage:(RVPage *)page {