diff --git a/cocoa/src/quartzcore.rs b/cocoa/src/quartzcore.rs index b3420c4..eb882a5 100644 --- a/cocoa/src/quartzcore.rs +++ b/cocoa/src/quartzcore.rs @@ -299,6 +299,13 @@ impl CALayer { } } + #[inline] + pub fn add_sublayer(&self, sublayer: &CALayer) { + unsafe { + msg_send![self.id(), addSublayer:sublayer.id()] + } + } + #[inline] pub fn insert_sublayer_at_index(&self, sublayer: &CALayer, index: u32) { unsafe { @@ -1193,6 +1200,13 @@ impl CALayer { msg_send![self.id(), reloadValueForKeyPath:key.as_CFTypeRef()] } } + + #[inline] + pub fn set_contents_opaque(&self, opaque: bool) { + unsafe { + msg_send![self.id(), setContentsOpaque:opaque as BOOL] + } + } } #[derive(Clone, Debug, PartialEq)] diff --git a/core-foundation/src/bundle.rs b/core-foundation/src/bundle.rs index 0e5909f..f23f9ae 100644 --- a/core-foundation/src/bundle.rs +++ b/core-foundation/src/bundle.rs @@ -15,9 +15,9 @@ use core_foundation_sys::base::kCFAllocatorDefault; use base::{CFType, TCFType}; use url::CFURL; use dictionary::CFDictionary; +use std::os::raw::c_void; use string::CFString; - declare_TCFType!{ /// A Bundle type. CFBundle, CFBundleRef @@ -36,6 +36,24 @@ impl CFBundle { } } + pub fn bundle_with_identifier(identifier: CFString) -> Option { + unsafe { + let bundle_ref = CFBundleGetBundleWithIdentifier(identifier.as_concrete_TypeRef()); + if bundle_ref.is_null() { + None + } else { + Some(TCFType::wrap_under_get_rule(bundle_ref)) + } + } + } + + pub fn function_pointer_for_name(&self, function_name: CFString) -> *const c_void { + unsafe { + CFBundleGetFunctionPointerForName(self.as_concrete_TypeRef(), + function_name.as_concrete_TypeRef()) + } + } + pub fn main_bundle() -> CFBundle { unsafe { let bundle_ref = CFBundleGetMainBundle();