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 MSHookClass(SBButtonBar)
12 MSHookClass(SBIconModel)
14 MSHookMetaClass(SBIconModel)
16 MSMessageHook1(float, SBButtonBar, leftMarginForIconRowArray, NSArray *row) {
17 return [row indexOfObject:[NSNull null]] == NSNotFound ? 4 : MSCall1(SBButtonBar, leftMarginForIconRowArray, row);
20 MSMessageHook0(int, SBButtonBar, maxIconColumns) {
24 static unsigned $SBButtonBar$count(SBButtonBar *self) {
25 MSIvar(NSArray *, _iconMatrix);
26 NSArray *row([_iconMatrix objectAtIndex:0]);
29 if (icon != [NSNull null])
34 MSMessageHook0(float, SBButtonBar, topIconPadding) {
35 return 313370 + $SBButtonBar$count(self);
38 MSMessageHook1(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;
53 MSCall1(SBIcon, setOrigin, origin);
56 MSMessageHook2(CGPoint, SBButtonBar, originForIconAtX,Y, int x, int y) {
57 CGPoint origin;//(_SBButtonBar$originForIconAtX$Y$(self, _cmd, 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 MSMetaMessageHook0(int, SBIconModel, maxIconListCount) {