3 #import <Foundation/NSArray.h>
4 #import <Foundation/NSNull.h>
5 #import <CoreGraphics/CGGeometry.h>
7 #import <SpringBoard/SBButtonBar.h>
8 #import <SpringBoard/SBIcon.h>
9 #import <SpringBoard/SBIconModel.h>
11 @interface SBDockIconListView : NSObject {
16 MSClassHook(SBButtonBar)
17 MSClassHook(SBDockIconListView)
19 MSClassHook(SBIconModel)
21 MSMetaClassHook(SBDockIconListView)
22 MSMetaClassHook(SBIconModel)
24 MSInstanceMessageHook1(float, SBButtonBar, leftMarginForIconRowArray, NSArray *, row) {
25 return [row indexOfObject:[NSNull null]] == NSNotFound ? 4 : MSOldCall(row);
28 MSInstanceMessageHook0(int, SBButtonBar, maxIconColumns) {
32 MSClassMessageHook1(int, SBDockIconListView, iconColumnsForInterfaceOrientation, int, orientation) {
36 static unsigned $SBButtonBar$count(SBButtonBar *self) {
37 MSIvarHook(NSArray *, _iconMatrix);
38 NSArray *row([_iconMatrix objectAtIndex:0]);
41 if (icon != [NSNull null])
46 MSInstanceMessageHook0(float, SBButtonBar, topIconPadding) {
47 return 313370 + $SBButtonBar$count(self);
50 MSInstanceMessageHook1(void, SBIcon, setOrigin, CGPoint, origin) {
51 unsigned count(origin.y);
58 else if (count > 10 || count < 0)
61 origin.x = (origin.x - 4) / 76 * 63 + 4;
68 MSInstanceMessageHook2(CGPoint, SBButtonBar, originForIconAtX,Y, int, x, int, y) {
69 CGPoint origin;//(MSOldCall(x, y, ));
70 //NSLog(@"f:%u,%u=(%f,%f)", x, y, origin.x, origin.y);
73 unsigned count($SBButtonBar$count(self)), gap;
74 unsigned space(320 - 60 * count);
77 gap = space / (count + 1);
78 else // I hate people who love Apple.
81 origin.x = (space - gap * (count - 1)) / 2 + (60 + gap) * x;
86 // XXX: merge with previous function if possible, but not until after iPhone 4
87 MSInstanceMessageHook2(CGPoint, SBDockIconListView, originForIconAtX,Y, int, x, int, y) {
88 CGPoint origin;//(MSOldCall(x, y, ));
89 //NSLog(@"f:%u,%u=(%f,%f)", x, y, origin.x, origin.y);
92 unsigned count([[self icons] count]), gap;
93 unsigned space(320 - 60 * count);
96 gap = space / (count + 1);
97 else // I hate people who love Apple.
100 origin.x = (space - gap * (count - 1)) / 2 + (60 + gap) * x;
105 /*MSClassMessageHook0(int, SBIconModel, maxIconListCount) {