ConsoleUtilitiesBinding.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #import "ConsoleUtilities.h"
  2. #include "DisplayManager.h"
  3. #define GetStringParam( _x_ ) ( _x_ != NULL ) ? [NSString stringWithUTF8String:_x_] : [NSString stringWithUTF8String:""]
  4. void _opencodingConsoleBeginEmail(const char * toAddress, const char * subject, const char * body, bool isHTML)
  5. {
  6. [[ConsoleUtilities instance] beginEmail:GetStringParam( toAddress )
  7. subject:GetStringParam( subject )
  8. body:GetStringParam( body )
  9. isHTML:isHTML];
  10. }
  11. void _opencodingConsoleAddAttachment(UInt8 *bytes, int length, const char * attachmentMimeType, const char * attachmentFilename)
  12. {
  13. NSData *data = [[NSData alloc] initWithBytes:(void*)bytes length:length];
  14. [[ConsoleUtilities instance] addAttachment: data
  15. mimeType:GetStringParam( attachmentMimeType )
  16. filename:GetStringParam( attachmentFilename )];
  17. }
  18. void _opencodingConsoleFinishEmail()
  19. {
  20. [[ConsoleUtilities instance] finishEmail];
  21. }
  22. void _opencodingConsoleCopyToClipboard(const char* text)
  23. {
  24. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
  25. pasteboard.string = GetStringParam(text);
  26. }
  27. int _opencodingConsoleGetNativeScreenWidth()
  28. {
  29. return [DisplayManager Instance].mainDisplay.screenSize.width;
  30. }