diff options
Diffstat (limited to 'tools/gfx/apple')
| -rw-r--r-- | tools/gfx/apple/cocoa-util.h | 12 | ||||
| -rw-r--r-- | tools/gfx/apple/cocoa-util.mm | 15 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tools/gfx/apple/cocoa-util.h b/tools/gfx/apple/cocoa-util.h new file mode 100644 index 000000000..80467d8a4 --- /dev/null +++ b/tools/gfx/apple/cocoa-util.h @@ -0,0 +1,12 @@ +#pragma once + +namespace gfx { + +// Utility functions for Cocoa +struct CocoaUtil { + + static void getNSViewRectSize(void* nsview, int* widthOut, int* heightOut); + +}; + +} diff --git a/tools/gfx/apple/cocoa-util.mm b/tools/gfx/apple/cocoa-util.mm new file mode 100644 index 000000000..45b1c3df0 --- /dev/null +++ b/tools/gfx/apple/cocoa-util.mm @@ -0,0 +1,15 @@ +#include "cocoa-util.h" + +#import <Cocoa/Cocoa.h> + +namespace gfx { + +void CocoaUtil::getNSViewRectSize(void* nsview, int* widthOut, int* heightOut) +{ + NSView* view = (NSView*)nsview; + NSRect rect = [view frame]; + *widthOut = rect.size.width; + *heightOut = rect.size.height; +} + +}
\ No newline at end of file |
