]> git.saurik.com Git - winterboard.git/commitdiff
Support text theming of icon badge labels on iOS 6.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 20 Sep 2012 21:46:29 +0000 (21:46 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 20 Sep 2012 21:46:29 +0000 (21:46 +0000)
Library.mm

index 6834da0db1a65e9a670b37fea2d68066e979f45d..2744675976efd2f6f8b61088ada8297ff024d8fd 100644 (file)
@@ -145,8 +145,11 @@ MSClassHook(SBCalendarApplicationIcon)
 MSClassHook(SBCalendarIconContentsView)
 MSClassHook(SBDockIconListView)
 MSClassHook(SBIcon)
+MSClassHook(SBIconAccessoryImage)
+MSMetaClassHook(SBIconAccessoryImage)
 MSClassHook(SBIconBadge)
 MSClassHook(SBIconBadgeFactory)
+MSClassHook(SBIconBadgeImage)
 MSClassHook(SBIconContentView)
 MSClassHook(SBIconController)
 MSClassHook(SBIconLabel)
@@ -184,6 +187,10 @@ static struct MSFixClass { MSFixClass() {
 static bool IsWild_;
 static bool Four_($SBDockIconListView != nil);
 
+@interface NSObject (wb$SBIconAccessoryImage)
++ (Class) _imageClassForIcon:(SBIcon *)icon location:(int)location;
+@end
+
 @interface NSDictionary (WinterBoard)
 - (UIColor *) wb$colorForKey:(NSString *)key;
 - (BOOL) wb$boolForKey:(NSString *)key;
@@ -882,6 +889,21 @@ MSInstanceMessageHook1(CGSize, NSString, sizeWithFont, UIFont *, font) {
     return [self sizeWithStyle:[NSString stringWithFormat:@"%@;%@;%@;%@", [font markupDescription], WBColorMarkup(), base, info] forWidth:65535];
 }
 
+MSClassMessageHook2(UIImage *, SBIconAccessoryImage, checkoutAccessoryImageForIcon,location, id, icon, int, location) {
+    if ([self _imageClassForIcon:icon location:location] != $SBIconBadgeImage)
+        return MSOldCall(icon, location);
+
+    WBStringDrawingState badgeState = {NULL, -1, @""
+    , @"BadgeStyle"};
+
+    stringDrawingState_ = &badgeState;
+
+    UIImage *image(MSOldCall(icon, location));
+
+    stringDrawingState_ = NULL;
+    return image;
+}
+
 MSInstanceMessageHook1(UIImage *, SBIconBadgeFactory, checkoutBadgeImageForText, NSString *, text) {
     WBStringDrawingState badgeState = {NULL, -1, @""
     , @"BadgeStyle"};