Permalink
Browse files

updated ios code (damn you, gitbox)

  • Loading branch information...
1 parent 45c7f89 commit d742e0a122100504a2442937ed6de22cdfdd7616 me committed Feb 26, 2012
View
@@ -19,4 +19,13 @@
destructiveLabel: (NSString*)destructiveLabel
otherLabels: (NSString*)otherLabels
context: (FREContext *)context;
+-(void)showActionSheetFromRect: (NSString *)title
+ closeLabel: (NSString*)closeLabel
+ destructiveLabel: (NSString*)destructiveLabel
+ otherLabels: (NSString*)otherLabels
+ xPos: (CGFloat)x
+ yPos: (CGFloat)y
+ widthPos: (CGFloat)width
+ heightPos: (CGFloat)height
+context: (FREContext *)ctx;
@end
View
No changes.
View
@@ -46,6 +46,58 @@ FREObject showActionSheet(FREContext ctx, void* funcData, uint32_t argc, FREObje
return NULL;
}
+FREObject showActionSheetFromRect(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[] )
+{
+ //Temporary values to hold our actionscript code.
+ uint32_t titleLength;
+ const uint8_t *title;
+ uint32_t destructiveLength;
+ const uint8_t *destructive;
+ uint32_t closeLength;
+ const uint8_t *closeLabel;
+ uint32_t otherLength;
+ const uint8_t *otherLabels;
+
+ double xPos;
+ double yPos;
+ double widthPos;
+ double heightPos;
+ //Turn our actionscrpt code into native code.
+ FREGetObjectAsUTF8(argv[0], &titleLength, &title);
+ FREGetObjectAsUTF8(argv[1], &closeLength, &closeLabel);
+ FREGetObjectAsUTF8(argv[2], &destructiveLength, &destructive);
+ FREGetObjectAsUTF8(argv[3], &otherLength, &otherLabels);
+ FREGetObjectAsDouble(argv[4], &xPos);
+ FREGetObjectAsDouble(argv[5], &yPos);
+ FREGetObjectAsDouble(argv[6], &widthPos);
+ FREGetObjectAsDouble(argv[7], &heightPos);
+ //Create our Strings for our Alert.
+ NSString *titleString = [NSString stringWithUTF8String:(char*)title];
+ NSString *closeLabelString = [NSString stringWithUTF8String:(char*)closeLabel];
+ NSString *destructiveString = [NSString stringWithUTF8String:(char*)destructive];
+ NSString *otherLabelsString = [NSString stringWithUTF8String:(char*)otherLabels];
+ CGFloat xPosString = xPos;
+ CGFloat yPosString = yPos;
+ CGFloat widthPosString = widthPos;
+ CGFloat heightPosString = heightPos;
+
+
+
+ MobileActionSheet *action = [[MobileActionSheet alloc] init];
+ [action showActionSheetFromRect:titleString
+ closeLabel:closeLabelString
+ destructiveLabel:destructiveString
+ otherLabels:otherLabelsString
+ xPos:xPosString
+ yPos:yPosString
+ widthPos:widthPosString
+ heightPos:heightPosString
+ context:ctx
+
+ ];
+ return NULL;
+}
+
//------------------------------------
//
@@ -60,13 +112,16 @@ void ContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx,
uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet)
{
- *numFunctionsToTest = 1;
+ *numFunctionsToTest = 2;
FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * 1);
func[0].name = (const uint8_t*) "showActionSheet";
func[0].functionData = NULL;
func[0].function = &showActionSheet;
-
+ func[1].name = (const uint8_t*) "showActionSheetFromRect";
+ func[1].functionData = NULL;
+ func[1].function = &showActionSheetFromRect;
+
*functionsToSet = func;
}

0 comments on commit d742e0a

Please sign in to comment.