3 #import <Foundation/NSArray.h>
4 #import <Foundation/NSNull.h>
5 #import <CoreGraphics/CGGeometry.h>
6 #import <SpringBoard/SBButtonBar.h>
7 #import <SpringBoard/SBIcon.h>
8 #import <SpringBoard/SBIconModel.h>
10 MSClassHook(SBButtonBar)
12 MSClassHook(SBIconModel)
14 MSMetaClassHook(SBIconModel)
16 MSInstanceMessageHook1(float, SBButtonBar, leftMarginForIconRowArray, NSArray *, row) {
17 return [row indexOfObject:[NSNull null]] == NSNotFound ? 4 : MSOldCall(row);
20 MSInstanceMessageHook0(int, SBButtonBar, maxIconColumns) {
24 static unsigned $SBButtonBar$count(SBButtonBar *self) {
25 MSIvarHook(NSArray *, _iconMatrix);
26 NSArray *row([_iconMatrix objectAtIndex:0]);
29 if (icon != [NSNull null])
34 MSInstanceMessageHook0(float, SBButtonBar, topIconPadding) {
35 return 313370 + $SBButtonBar$count(self);
38 MSInstanceMessageHook1(void, SBIcon, setOrigin, CGPoint, origin) {
39 unsigned count(origin.y);
46 else if (count > 10 || count < 0)
49 origin.x = (origin.x - 4) / 76 * 63 + 4;
56 MSInstanceMessageHook2(CGPoint, SBButtonBar, originForIconAtX,Y, int, x, int, y) {
57 CGPoint origin;//(MSOldCall(x, y, ));
58 //NSLog(@"f:%u,%u=(%f,%f)", x, y, origin.x, origin.y);
61 unsigned count($SBButtonBar$count(self)), gap;
62 unsigned space(320 - 60 * count);
65 gap = space / (count + 1);
66 else // I hate people who love Apple.
69 origin.x = (space - gap * (count - 1)) / 2 + (60 + gap) * x;
74 /*MSClassMessageHook0(int, SBIconModel, maxIconListCount) {