ASPiK SDK
macglobals.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __macglobals__
6 #define __macglobals__
7 
8 #include "../../vstguibase.h"
9 
10 #if MAC
11 
12 #include "../../crect.h"
13 #include "../../cpoint.h"
14 
15 #if TARGET_OS_IPHONE
16  #include <CoreFoundation/CoreFoundation.h>
17  #include <CoreGraphics/CoreGraphics.h>
18 #else
19  #include <ApplicationServices/ApplicationServices.h>
20 #endif
21 
22 namespace VSTGUI {
23 struct CColor;
24 
25 // TODO: This needs to be done a nicer fashion
26 extern void* gBundleRef;
27 inline CFBundleRef getBundleRef () { return (CFBundleRef)gBundleRef; }
28 extern CGColorSpaceRef GetCGColorSpace ();
29 extern CGColorRef getCGColor (const CColor& color);
30 
31 //-----------------------------------------------------------------------------
32 inline CRect CRectFromCGRect (const CGRect& r)
33 {
34  return CRect (CPoint (r.origin.x, r.origin.y), CPoint (r.size.width, r.size.height));
35 }
36 
37 //-----------------------------------------------------------------------------
38 inline CGRect CGRectFromCRect (const CRect& r)
39 {
40  return CGRectMake (static_cast<CGFloat> (r.left), static_cast<CGFloat> (r.top), static_cast<CGFloat> (r.getWidth ()), static_cast<CGFloat> (r.getHeight ()));
41 }
42 
43 //-----------------------------------------------------------------------------
44 inline CPoint CPointFromCGPoint (const CGPoint& p)
45 {
46  return CPoint (p.x, p.y);
47 }
48 
49 //-----------------------------------------------------------------------------
50 inline CGPoint CGPointFromCPoint (const CPoint& p)
51 {
52  return CGPointMake (static_cast<CGFloat> (p.x), static_cast<CGFloat> (p.y));
53 }
54 
55 //-----------------------------------------------------------------------------
56 inline CGSize CGSizeFromCPoint (const CPoint& p)
57 {
58  return CGSizeMake (static_cast<CGFloat> (p.x), static_cast<CGFloat> (p.y));
59 }
60 
61 } // namespace
62 
63 #endif // MAC
64 #endif // __macglobals__
Definition: customcontrols.cpp:8