Permalink
Browse files

make it a bit smarter and less hardcoded on the attitude adjusted value

  • Loading branch information...
1 parent 09e1271 commit b42d5df573c9add6e2cedf6addce31a8666438fb @lechium lechium committed Sep 17, 2011
Showing with 13 additions and 6 deletions.
  1. +7 −3 SMFDropShadowControl.m
  2. +6 −3 SMFListDropShadowControl.m
View
@@ -315,12 +315,12 @@ - (id)getListFromMenuItem:(id)menuItem
//given the BRBlueGlowSelectionLozengeLayer control, spit out our stub class with the proper positioning.
-- (id)synthesizeMockItemFrom:(id)theSender
+- (id)synthesizeMockItemFrom:(id)theSender withX:(float)xValue
{
SMFMockMenuItem *menuItem = [[SMFMockMenuItem alloc] init];
CGPoint newPosition = [theSender position];
- newPosition.x = 948.0f; //said attitude adjustment, without setting this x variable properly, all hell breaks loose.
+ newPosition.x = xValue; //said attitude adjustment, without setting this x variable properly, all hell breaks loose.
[menuItem setBounds:[theSender bounds]];
[menuItem setPosition:newPosition];
@@ -334,6 +334,9 @@ - (id)synthesizeMockItem
id theList = [self getListFromMenuItem:sender];
if (theList == nil)
return nil;
+
+ CGPoint listPosition = [theList position];
+ float xValue = listPosition.x;
NSEnumerator *controlEnum = [[theList controls] objectEnumerator];
id current = nil;
while ((current = [controlEnum nextObject]))
@@ -342,14 +345,15 @@ - (id)synthesizeMockItem
if ([currentClass isEqualToString:@"BRBlueGlowSelectionLozengeLayer"])
{
- return [self synthesizeMockItemFrom:current];
+ return [self synthesizeMockItemFrom:current withX:xValue];
}
}
return nil;
}
+
-(void)dealloc
{
[sender release];
@@ -375,12 +375,12 @@ - (id)getListFromMenuItem:(id)menuItem
//given the BRBlueGlowSelectionLozengeLayer control, spit out our stub class with the proper positioning.
-- (id)synthesizeMockItemFrom:(id)theSender
+- (id)synthesizeMockItemFrom:(id)theSender withX:(float)xValue
{
SMFMockMenuItem *menuItem = [[SMFMockMenuItem alloc] init];
CGPoint newPosition = [theSender position];
- newPosition.x = 948.0f; //said attitude adjustment, without setting this x variable properly, all hell breaks loose.
+ newPosition.x = xValue; //said attitude adjustment, without setting this x variable properly, all hell breaks loose.
[menuItem setBounds:[theSender bounds]];
[menuItem setPosition:newPosition];
@@ -394,6 +394,9 @@ - (id)synthesizeMockItem
id theList = [self getListFromMenuItem:sender];
if (theList == nil)
return nil;
+
+ CGPoint listPosition = [theList position];
+ float xValue = listPosition.x;
NSEnumerator *controlEnum = [[theList controls] objectEnumerator];
id current = nil;
while ((current = [controlEnum nextObject]))
@@ -402,7 +405,7 @@ - (id)synthesizeMockItem
if ([currentClass isEqualToString:@"BRBlueGlowSelectionLozengeLayer"])
{
- return [self synthesizeMockItemFrom:current];
+ return [self synthesizeMockItemFrom:current withX:xValue];
}
}

0 comments on commit b42d5df

Please sign in to comment.