diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2024-08-16 17:21:53 +1000 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2024-08-16 17:21:53 +1000 |
commit | ae3b01d2b1eb8dc532f616fb2f24aac954775f45 (patch) | |
tree | 17247b5f07753ab2d81758ce64c6f677ff26b41a /cocoa/DictionaryForCF.h | |
parent | dcbc339899911e1a3a743de1c0c25d0c253dd39a (diff) | |
download | scintilla-mirror-ae3b01d2b1eb8dc532f616fb2f24aac954775f45.tar.gz |
On Cocoa implement more values of font weight and stretch.
Diffstat (limited to 'cocoa/DictionaryForCF.h')
-rw-r--r-- | cocoa/DictionaryForCF.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/cocoa/DictionaryForCF.h b/cocoa/DictionaryForCF.h new file mode 100644 index 000000000..09233bab5 --- /dev/null +++ b/cocoa/DictionaryForCF.h @@ -0,0 +1,36 @@ +/** + * Scintilla source code edit control + * @file DictionaryForCF.h - Wrapper for CFMutableDictionary + * + * Copyright 2024 Neil Hodgson. + * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). + */ + +#ifndef DICTIONARYFORCF_H +#define DICTIONARYFORCF_H + +class DictionaryForCF { + CFMutableDictionaryRef dict; +public: + DictionaryForCF() noexcept : + dict(::CFDictionaryCreateMutable(kCFAllocatorDefault, 2, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks)) { + } + ~DictionaryForCF() { + ::CFRelease(dict); + } + CFMutableDictionaryRef get() const noexcept { + return dict; + } + void SetValue(const void *key, const void *value) noexcept { + ::CFDictionarySetValue(dict, key, value); + } + void SetItem(const void *key, CFNumberType theType, const void *valuePtr) noexcept { + CFNumberRef number = ::CFNumberCreate(kCFAllocatorDefault, theType, valuePtr); + ::CFDictionarySetValue(dict, key, number); + ::CFRelease(number); + } +}; + +#endif |