#import <Foundation/NSArray.h>
#import <Foundation/NSNull.h>
#import <CoreGraphics/CGGeometry.h>
+
#import <SpringBoard/SBButtonBar.h>
#import <SpringBoard/SBIcon.h>
#import <SpringBoard/SBIconModel.h>
+@interface SBDockIconListView : NSObject {
+}
+- (NSArray *) icons;
+@end
+
MSClassHook(SBButtonBar)
+MSClassHook(SBDockIconListView)
MSClassHook(SBIcon)
MSClassHook(SBIconModel)
+MSMetaClassHook(SBDockIconListView)
MSMetaClassHook(SBIconModel)
MSInstanceMessageHook1(float, SBButtonBar, leftMarginForIconRowArray, NSArray *, row) {
return 5;
}
+MSClassMessageHook1(int, SBDockIconListView, iconColumnsForInterfaceOrientation, int, orientation) {
+ return 5;
+}
+
static unsigned $SBButtonBar$count(SBButtonBar *self) {
MSIvarHook(NSArray *, _iconMatrix);
NSArray *row([_iconMatrix objectAtIndex:0]);
return origin;
}
+// XXX: merge with previous function if possible, but not until after iPhone 4
+MSInstanceMessageHook2(CGPoint, SBDockIconListView, originForIconAtX,Y, int, x, int, y) {
+ CGPoint origin;//(MSOldCall(x, y, ));
+ //NSLog(@"f:%u,%u=(%f,%f)", x, y, origin.x, origin.y);
+ origin.y = 11;
+
+ unsigned count([[self icons] count]), gap;
+ unsigned space(320 - 60 * count);
+
+ if (count >= 4)
+ gap = space / (count + 1);
+ else // I hate people who love Apple.
+ gap = 16;
+
+ origin.x = (space - gap * (count - 1)) / 2 + (60 + gap) * x;
+
+ return origin;
+}
+
/*MSClassMessageHook0(int, SBIconModel, maxIconListCount) {
return 16;
}*/