]> git.saurik.com Git - winterboard.git/commitdiff
Commit most of the new layout I'd been working on.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 26 Nov 2014 10:32:27 +0000 (02:32 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 26 Nov 2014 10:34:07 +0000 (02:34 -0800)
Settings.mm
makefile

index 7d15baabc56a9325dcc7ca2dfa96f41ffa035700..7beb1f33313e28c7dff4b694ec004bb27293dc25 100644 (file)
@@ -28,6 +28,7 @@
 #import <Preferences/PSTableCell.h>
 #import <UIKit/UINavigationButton.h>
 
+#include <cmath>
 #include <dlfcn.h>
 #include <objc/runtime.h>
 
@@ -139,23 +140,55 @@ void AddThemes(NSMutableArray *themesOnDisk, NSString *folder) {
 
 /* Theme Settings Controller {{{ */
 @interface WBSThemesTableViewCell : UITableViewCell {
+    UIImageView *checkmark_;
+    UIImageView *icon_;
+    UILabel *name_;
 }
 
 @end
 
 @implementation WBSThemesTableViewCell
 
+- (void) dealloc {
+    [super dealloc];
+    [checkmark_ release];
+    [icon_ release];
+    [name_ release];
+}
+
 - (id) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuse {
     if ((self = [super initWithFrame:frame reuseIdentifier:reuse]) != nil) {
+        CGFloat border(48), check(40), icon(64);
+        UIView *content([self contentView]);
+        CGSize size([content frame].size);
+
+        checkmark_ = [[UIImageView alloc] initWithFrame:CGRectMake(std::floor((border - check) / 2), 0, check, size.height)];
+        [checkmark_ setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
+        [content addSubview:checkmark_];
+
+        name_ = [[UILabel alloc] initWithFrame:CGRectMake(border, 0, 0, size.height)];
+        [name_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
+        [content addSubview:name_];
+
+        icon_ = [[UIImageView alloc] initWithFrame:CGRectMake(size.width - icon - 48, 0, icon, icon)];
+        [content addSubview:icon_];
     } return self;
 }
 
+- (void) setCheck:(bool)inactive {
+    [self setImage:(inactive ? uncheckedImage : checkImage)];
+}
+
 - (void) setTheme:(NSDictionary *)theme {
-    self.text = [theme objectForKey:@"Name"];
-    self.hidesAccessoryWhenEditing = NO;
+    [name_ setText:[theme objectForKey:@"Name"]];
+
     NSNumber *active([theme objectForKey:@"Active"]);
     BOOL inactive(active == nil || ![active boolValue]);
-    [self setImage:(inactive ? uncheckedImage : checkImage)];
+    [self setCheck:inactive];
+
+    CGRect area([name_ frame]);
+    area.size.width = ([icon_ image] == nil ? self.contentView.frame.size.width : icon_.frame.origin.x) - area.origin.x - 9;
+    [name_ setFrame:area];
 }
 
 @end
@@ -247,7 +280,8 @@ void AddThemes(NSMutableArray *themesOnDisk, NSString *folder) {
             nil] atIndex:0];
         }
 
-        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 480-64) style:UITableViewStyleGrouped];
+        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 480-64) style:UITableViewStylePlain];
+        [_tableView setRowHeight:48];
         [_tableView setDataSource:self];
         [_tableView setDelegate:self];
         [_tableView setEditing:YES];
index a97f4de1dd495e173064a52229ede7507e957a57..68fc6bc9b026d8cec3183490db4992bfcab304fe 100644 (file)
--- a/makefile
+++ b/makefile
@@ -8,7 +8,7 @@ clean:
        rm -f WinterBoard WinterBoard.dylib WinterBoardSettings Optimize
 
 WinterBoardSettings: Settings.mm makefile
-       $(cycc) -dynamiclib \
+       $(cycc) -std=c++11 -dynamiclib \
            -framework UIKit \
            -framework CoreFoundation \
            -framework Foundation \