Guest User

Objective-C and C++ mixing together.

a guest
Aug 5th, 2014
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Header:
  2.  
  3. #import <Cocoa/Cocoa.h>
  4.  
  5. @class NativeInterfaceExtensions_;
  6.  
  7. namespace nim {
  8. namespace interface {
  9.  
  10. struct NativeInterfaceExtensions
  11. {
  12.   NativeInterfaceExtensions(id window);
  13.   ~NativeInterfaceExtensions();
  14. private:
  15.   NativeInterfaceExtensions_* nativeWindow;
  16. };
  17.  
  18. }
  19. }
  20.  
  21. // Source:
  22.  
  23. #import "NativeMainWindow.h"
  24.  
  25. @interface NativeInterfaceExtensions_ : NSObject
  26.  
  27. @property(copy) NSWindow* WindowHandler;
  28.  
  29. - (id) initWithWindowHandler:(id)window;
  30.  
  31. @end
  32.  
  33. @implementation NativeInterfaceExtensions_
  34.  
  35. @synthesize WindowHandler;
  36.  
  37. - (id) initWithWindowHandler:(id)window {
  38.   self = [super self];
  39.   if (self) {
  40.     NSLog(@"%d", (int)[window isKindOfClass:[NSWindow class]]);
  41.     WindowHandler = (NSWindow*)window;
  42.     return self;
  43.   }
  44.  
  45.   return nil;
  46. }
  47.  
  48. @end
  49.  
  50. using namespace nim::interface;
  51.  
  52. NativeInterfaceExtensions::NativeInterfaceExtensions(id window) {
  53.     nativeWindow = [[NativeInterfaceExtensions_ alloc] initWithWindowHandler:window];
  54. }
  55.  
  56. NativeInterfaceExtensions::~NativeInterfaceExtensions() {
  57.   [nativeWindow release];
  58. }
Advertisement
Add Comment
Please, Sign In to add comment