Add wx headers and ext
This commit is contained in:
parent
6390dcef6a
commit
66d3c7b811
1531 changed files with 295895 additions and 0 deletions
109
wxheaders/wx/osx/core/cfarray.h
Normal file
109
wxheaders/wx/osx/core/cfarray.h
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/cfarrayref.h
|
||||
// Purpose: wxCFArrayRef class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 2018/07/27
|
||||
// Copyright: (c) 2018 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*! @header wx/osx/core/cfarrayref.h
|
||||
@abstract wxCFArrayRef class
|
||||
*/
|
||||
|
||||
#ifndef _WX_OSX_COREFOUNDATION_CFARRAYREF_H__
|
||||
#define _WX_OSX_COREFOUNDATION_CFARRAYREF_H__
|
||||
|
||||
#include "wx/osx/core/cfref.h"
|
||||
#include "wx/osx/core/cftype.h"
|
||||
|
||||
#include <CoreFoundation/CFArray.h>
|
||||
|
||||
template <typename T, typename E>
|
||||
class wxCFArrayRefCommon : public wxCFRef<T>
|
||||
{
|
||||
public:
|
||||
typedef wxCFRef<T> super_type;
|
||||
typedef size_t size_type;
|
||||
|
||||
wxCFArrayRefCommon(T r)
|
||||
: super_type(r)
|
||||
{
|
||||
}
|
||||
|
||||
wxCFArrayRefCommon(const wxCFArrayRefCommon& otherRef)
|
||||
: super_type(otherRef)
|
||||
{
|
||||
}
|
||||
|
||||
size_type size() const
|
||||
{
|
||||
return (size_type)CFArrayGetCount(this->m_ptr);
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
wxCFRef<E> at(size_type idx)
|
||||
{
|
||||
wxASSERT(idx < size());
|
||||
|
||||
return wxCFRefFromGet((E)CFArrayGetValueAtIndex(this->m_ptr, idx));
|
||||
}
|
||||
|
||||
operator WX_NSArray() { return (WX_NSArray) this->get(); }
|
||||
|
||||
wxCFRef<E> operator[](size_type idx) { return at(idx); }
|
||||
wxCFRef<E> front() { return at(0); }
|
||||
wxCFRef<E> back() { return at(size() - 1); }
|
||||
};
|
||||
|
||||
|
||||
template <typename E>
|
||||
class wxCFArrayRef : public wxCFArrayRefCommon<CFArrayRef, E>
|
||||
{
|
||||
public:
|
||||
wxCFArrayRef(CFArrayRef r)
|
||||
: wxCFArrayRefCommon<CFArrayRef, E>(r)
|
||||
{
|
||||
}
|
||||
|
||||
wxCFArrayRef(const wxCFArrayRef& otherRef)
|
||||
: wxCFArrayRefCommon<CFArrayRef, E>(otherRef)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <typename E>
|
||||
class wxCFMutableArrayRef : public wxCFArrayRefCommon<CFMutableArrayRef, E>
|
||||
{
|
||||
public:
|
||||
wxCFMutableArrayRef()
|
||||
: wxCFArrayRefCommon<CFMutableArrayRef, E>(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks))
|
||||
{
|
||||
}
|
||||
|
||||
wxCFMutableArrayRef(CFMutableArrayRef r)
|
||||
: wxCFArrayRefCommon<CFMutableArrayRef, E>(r)
|
||||
{
|
||||
}
|
||||
|
||||
wxCFMutableArrayRef(const wxCFMutableArrayRef& otherRef)
|
||||
: wxCFArrayRefCommon<CFMutableArrayRef, E>(otherRef)
|
||||
{
|
||||
}
|
||||
|
||||
void push_back(E v)
|
||||
{
|
||||
CFArrayAppendValue(this->m_ptr, v);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
CFArrayRemoveAllValues(this->m_ptr);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //ifndef _WX_OSX_COREFOUNDATION_CFARRAYREF_H__
|
||||
95
wxheaders/wx/osx/core/cfdataref.h
Normal file
95
wxheaders/wx/osx/core/cfdataref.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/cfdataref.h
|
||||
// Purpose: wxCFDataRef class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 2007/05/10
|
||||
// Copyright: (c) 2007 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
// Notes: See http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBinaryData/index.html
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*! @header wx/osx/core/cfdataref.h
|
||||
@abstract wxCFDataRef template class
|
||||
*/
|
||||
|
||||
#ifndef _WX_MAC_COREFOUNDATION_CFDATAREF_H__
|
||||
#define _WX_MAC_COREFOUNDATION_CFDATAREF_H__
|
||||
|
||||
#include "wx/osx/core/cfref.h"
|
||||
|
||||
#include <CoreFoundation/CFData.h>
|
||||
|
||||
/*! @class wxCFDataRef
|
||||
@discussion Properly retains/releases reference to CoreFoundation data objects
|
||||
*/
|
||||
class wxCFDataRef : public wxCFRef< CFDataRef >
|
||||
{
|
||||
public:
|
||||
/*! @method wxCFDataRef
|
||||
@abstract Creates a NULL data ref
|
||||
*/
|
||||
wxCFDataRef()
|
||||
{}
|
||||
|
||||
typedef wxCFRef<CFDataRef> super_type;
|
||||
|
||||
/*! @method wxCFDataRef
|
||||
@abstract Assumes ownership of r and creates a reference to it.
|
||||
@param r The data reference to assume ownership of. May be NULL.
|
||||
@discussion Like shared_ptr, it is assumed that the caller has a strong reference to r and intends
|
||||
to transfer ownership of that reference to this ref holder. If the object comes from
|
||||
a Create or Copy method then this is the correct behaviour. If the object comes from
|
||||
a Get method then you must CFRetain it yourself before passing it to this constructor.
|
||||
A handy way to do this is to use the non-member wxCFRefFromGet factory function.
|
||||
This method is templated and takes an otherType *p. This prevents implicit conversion
|
||||
using an operator refType() in a different ref-holding class type.
|
||||
*/
|
||||
explicit wxCFDataRef(CFDataRef r)
|
||||
: super_type(r)
|
||||
{}
|
||||
|
||||
/*! @method wxCFDataRef
|
||||
@abstract Copies a ref holder of the same type
|
||||
@param otherRef The other ref holder to copy.
|
||||
@discussion Ownership will be shared by the original ref and the newly created ref. That is,
|
||||
the object will be explicitly retained by this new ref.
|
||||
*/
|
||||
wxCFDataRef(const wxCFDataRef& otherRef)
|
||||
: super_type( otherRef )
|
||||
{}
|
||||
|
||||
/*! @method wxCFDataRef
|
||||
@abstract Copies raw data into a data ref
|
||||
@param data The raw data.
|
||||
@param length The data length.
|
||||
*/
|
||||
wxCFDataRef(const UInt8* data, CFIndex length)
|
||||
: super_type(CFDataCreate(kCFAllocatorDefault, data, length))
|
||||
{
|
||||
}
|
||||
|
||||
/*! @method GetLength
|
||||
@abstract returns the length in bytes of the data stored
|
||||
*/
|
||||
CFIndex GetLength() const
|
||||
{
|
||||
if ( m_ptr )
|
||||
return CFDataGetLength( *this );
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! @method GetBytes
|
||||
@abstract Copies the data into an external buffer
|
||||
@param range The desired range.
|
||||
@param buffer The target buffer.
|
||||
*/
|
||||
void GetBytes( CFRange range, UInt8 *buffer ) const
|
||||
{
|
||||
if ( m_ptr )
|
||||
CFDataGetBytes(m_ptr, range, buffer);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //ifndef _WX_MAC_COREFOUNDATION_CFDATAREF_H__
|
||||
|
||||
137
wxheaders/wx/osx/core/cfdictionary.h
Normal file
137
wxheaders/wx/osx/core/cfdictionary.h
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/cfdictionaryref.h
|
||||
// Purpose: wxCFDictionaryRef class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 2018/07/27
|
||||
// Copyright: (c) 2018 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*! @header wx/osx/core/cfdictionaryref.h
|
||||
@abstract wxCFDictionaryRef class
|
||||
*/
|
||||
|
||||
#ifndef _WX_OSX_COREFOUNDATION_CFDICTIONARYREF_H__
|
||||
#define _WX_OSX_COREFOUNDATION_CFDICTIONARYREF_H__
|
||||
|
||||
#include "wx/osx/core/cfref.h"
|
||||
#include "wx/osx/core/cfstring.h"
|
||||
#include "wx/osx/core/cftype.h"
|
||||
|
||||
#include <CoreFoundation/CFDictionary.h>
|
||||
|
||||
/*! @class wxCFDictionaryRef
|
||||
@discussion Properly retains/releases reference to CoreFoundation data objects
|
||||
*/
|
||||
template <typename T>
|
||||
class wxCFDictionaryRefCommon : public wxCFRef<T>
|
||||
{
|
||||
public:
|
||||
typedef wxCFRef<T> super_type;
|
||||
|
||||
explicit wxCFDictionaryRefCommon()
|
||||
: super_type()
|
||||
{
|
||||
}
|
||||
|
||||
/*! @method wxCFDictionaryRef
|
||||
@abstract Assumes ownership of r and creates a reference to it.
|
||||
@param r The dictionary reference to assume ownership of. May be NULL.
|
||||
@discussion Like shared_ptr, it is assumed that the caller has a strong reference to r and intends
|
||||
to transfer ownership of that reference to this ref holder. If the object comes from
|
||||
a Create or Copy method then this is the correct behaviour. If the object comes from
|
||||
a Get method then you must CFRetain it yourself before passing it to this constructor.
|
||||
A handy way to do this is to use the non-member wxCFRefFromGet factory function.
|
||||
This method is templated and takes an otherType *p. This prevents implicit conversion
|
||||
using an operator refType() in a different ref-holding class type.
|
||||
*/
|
||||
explicit wxCFDictionaryRefCommon(T r)
|
||||
: super_type(r)
|
||||
{
|
||||
}
|
||||
|
||||
/*! @method wxCFDictionaryRef
|
||||
@abstract Copies a ref holder of the same type
|
||||
@param otherRef The other ref holder to copy.
|
||||
@discussion Ownership will be shared by the original ref and the newly created ref. That is,
|
||||
the object will be explicitly retained by this new ref.
|
||||
*/
|
||||
wxCFDictionaryRefCommon(const wxCFDictionaryRefCommon&) = default;
|
||||
|
||||
wxCFTypeRef GetValue(const void* key)
|
||||
{
|
||||
CFTypeRef val = CFDictionaryGetValue(this->m_ptr, key);
|
||||
if (val)
|
||||
::CFRetain(val);
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
class wxCFMutableDictionaryRef;
|
||||
|
||||
class wxCFDictionaryRef : public wxCFDictionaryRefCommon<CFDictionaryRef>
|
||||
{
|
||||
public:
|
||||
wxCFDictionaryRef()
|
||||
{
|
||||
}
|
||||
|
||||
wxCFDictionaryRef(CFDictionaryRef r)
|
||||
: wxCFDictionaryRefCommon(r)
|
||||
{
|
||||
}
|
||||
|
||||
wxCFDictionaryRef& operator=(const wxCFMutableDictionaryRef& other);
|
||||
|
||||
CFDictionaryRef CreateCopy() const
|
||||
{
|
||||
return CFDictionaryCreateCopy(kCFAllocatorDefault, this->m_ptr);
|
||||
}
|
||||
|
||||
CFMutableDictionaryRef CreateMutableCopy() const
|
||||
{
|
||||
return CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, this->m_ptr);
|
||||
}
|
||||
};
|
||||
|
||||
class wxCFMutableDictionaryRef : public wxCFDictionaryRefCommon<CFMutableDictionaryRef>
|
||||
{
|
||||
public:
|
||||
wxCFMutableDictionaryRef()
|
||||
: wxCFDictionaryRefCommon(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks))
|
||||
{
|
||||
}
|
||||
|
||||
wxCFMutableDictionaryRef(CFMutableDictionaryRef r)
|
||||
: wxCFDictionaryRefCommon(r)
|
||||
{
|
||||
}
|
||||
|
||||
void SetValue(const void* key, const void* data)
|
||||
{
|
||||
CFDictionarySetValue(this->m_ptr, key, data);
|
||||
}
|
||||
|
||||
void SetValue(const void* key, CGFloat v)
|
||||
{
|
||||
SetValue(key, wxCFNumberRef(v));
|
||||
}
|
||||
|
||||
CFMutableDictionaryRef CreateCopy() const
|
||||
{
|
||||
return CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, this->m_ptr);
|
||||
}
|
||||
|
||||
friend class wxCFDictionaryRef;
|
||||
};
|
||||
|
||||
inline wxCFDictionaryRef& wxCFDictionaryRef::operator=(const wxCFMutableDictionaryRef& otherRef)
|
||||
{
|
||||
wxCFRetain(otherRef.m_ptr);
|
||||
wxCFRelease(m_ptr);
|
||||
m_ptr = (CFDictionaryRef)otherRef.m_ptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif //ifndef _WX_OSX_COREFOUNDATION_CFDICTIONARYREF_H__
|
||||
447
wxheaders/wx/osx/core/cfref.h
Normal file
447
wxheaders/wx/osx/core/cfref.h
Normal file
|
|
@ -0,0 +1,447 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/cfref.h
|
||||
// Purpose: wxCFRef template class
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by: Stefan Csomor
|
||||
// Created: 2007/05/10
|
||||
// Copyright: (c) 2007 David Elliott <dfe@cox.net>, Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
// Notes: See http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/index.html
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*! @header wx/osx/core/cfref.h
|
||||
@abstract wxCFRef template class
|
||||
@discussion FIXME: Convert doc tags to something less buggy with C++
|
||||
*/
|
||||
|
||||
#ifndef _WX_MAC_COREFOUNDATION_CFREF_H__
|
||||
#define _WX_MAC_COREFOUNDATION_CFREF_H__
|
||||
|
||||
// Include unistd to ensure that NULL is defined
|
||||
#include <unistd.h>
|
||||
// Include Availability for __AVAILABILITY_INTERNAL_DEPRECATED
|
||||
#include <Availability.h>
|
||||
|
||||
#if __has_feature(objc_arc)
|
||||
#define WX_OSX_BRIDGE_RETAINED __bridge_retained
|
||||
#define WX_OSX_BRIDGE __bridge
|
||||
#else
|
||||
#define WX_OSX_BRIDGE_RETAINED
|
||||
#define WX_OSX_BRIDGE
|
||||
#endif
|
||||
|
||||
// #include <CoreFoundation/CFBase.h>
|
||||
/* Don't include CFBase.h such that this header can be included from public
|
||||
* headers with minimal namespace pollution.
|
||||
* Note that Darwin CF uses extern for CF_EXPORT. If we need this on Win32
|
||||
* or non-Darwin Mac OS we'll need to define the appropriate __declspec.
|
||||
*/
|
||||
|
||||
typedef const void *CFTypeRef;
|
||||
extern "C" {
|
||||
extern /* CF_EXPORT */
|
||||
CFTypeRef CFRetain(CFTypeRef cf);
|
||||
extern /* CF_EXPORT */
|
||||
void CFRelease(CFTypeRef cf);
|
||||
extern /* CF_EXPORT */
|
||||
CFTypeRef CFAutorelease(CFTypeRef cf);
|
||||
} // extern "C"
|
||||
|
||||
|
||||
/*! @function wxCFRelease
|
||||
@abstract A CFRelease variant that checks for NULL before releasing.
|
||||
@discussion The parameter is template not for type safety but to ensure the argument
|
||||
is a raw pointer and not a ref holder of any type.
|
||||
*/
|
||||
template <class Type>
|
||||
inline void wxCFRelease(Type *r)
|
||||
{
|
||||
if ( r != NULL )
|
||||
::CFRelease((CFTypeRef)r);
|
||||
}
|
||||
|
||||
/*! @function wxCFAutorelease
|
||||
@abstract A CFAutorelease variant that checks for NULL before releasing.
|
||||
@discussion The parameter is template not for type safety but to ensure the argument
|
||||
is a raw pointer and not a ref holder of any type.
|
||||
*/
|
||||
template <class Type>
|
||||
inline Type* wxCFAutorelease(Type *r)
|
||||
{
|
||||
if ( r != NULL )
|
||||
r = const_cast<Type*>(static_cast<const Type*>(::CFAutorelease(static_cast<CFTypeRef>(r))));
|
||||
return r;
|
||||
}
|
||||
|
||||
/*! @function wxCFRetain
|
||||
@abstract A typesafe CFRetain variant that checks for NULL.
|
||||
*/
|
||||
template <class Type>
|
||||
inline Type* wxCFRetain(Type *r)
|
||||
{
|
||||
// NOTE(DE): Setting r to the result of CFRetain improves efficiency on both x86 and PPC
|
||||
// Casting r to CFTypeRef ensures we are calling the real C version defined in CFBase.h
|
||||
// and not any possibly templated/overloaded CFRetain.
|
||||
if ( r != NULL )
|
||||
r = const_cast<Type*>(static_cast<const Type*>(::CFRetain(static_cast<CFTypeRef>(r))));
|
||||
return r;
|
||||
}
|
||||
|
||||
template <class refType>
|
||||
class wxCFRef;
|
||||
|
||||
/*! @class wxCFWeakRef
|
||||
@templatefield refType The CF reference type (e.g. CFStringRef, CFRunLoopRef, etc.)
|
||||
It should already be a pointer. This is different from
|
||||
shared_ptr where the template parameter is the pointee type.
|
||||
@discussion Wraps a raw pointer without any retain or release.
|
||||
Provides a way to get what amounts to a raw pointer from a wxCFRef without
|
||||
using a raw pointer. Unlike a raw pointer, constructing a wxCFRef from this
|
||||
class will cause it to be retained because it is assumed that a wxCFWeakRef
|
||||
does not own its pointer.
|
||||
*/
|
||||
template <class refType>
|
||||
class wxCFWeakRef
|
||||
{
|
||||
template <class refTypeA, class otherRefType>
|
||||
friend wxCFWeakRef<refTypeA> static_cfref_cast(const wxCFRef<otherRefType> &otherRef);
|
||||
public:
|
||||
/*! @method wxCFWeakRef
|
||||
@abstract Creates a NULL reference
|
||||
*/
|
||||
wxCFWeakRef()
|
||||
: m_ptr(NULL)
|
||||
{}
|
||||
|
||||
// Default copy constructor is fine.
|
||||
// Default destructor is fine but we'll set NULL to avoid bugs
|
||||
~wxCFWeakRef()
|
||||
{ m_ptr = NULL; }
|
||||
|
||||
// Do not implement a raw-pointer constructor.
|
||||
|
||||
/*! @method wxCFWeakRef
|
||||
@abstract Copies another ref holder where its type can be converted to ours
|
||||
@templatefield otherRefType Any type held by another wxCFWeakRef.
|
||||
@param otherRef The other weak ref holder to copy.
|
||||
@discussion This is merely a copy or implicit cast.
|
||||
*/
|
||||
template <class otherRefType>
|
||||
wxCFWeakRef(const wxCFWeakRef<otherRefType>& otherRef)
|
||||
: m_ptr(otherRef.get()) // Implicit conversion from otherRefType to refType should occur
|
||||
{}
|
||||
|
||||
/*! @method wxCFWeakRef
|
||||
@abstract Copies a strong ref holder where its type can be converted to ours
|
||||
@templatefield otherRefType Any type held by a wxCFRef.
|
||||
@param otherRef The strong ref holder to copy.
|
||||
@discussion This ref is merely a pointer copy, the strong ref still holds the pointer.
|
||||
*/
|
||||
template <class otherRefType>
|
||||
wxCFWeakRef(const wxCFRef<otherRefType>& otherRef)
|
||||
: m_ptr(otherRef.get()) // Implicit conversion from otherRefType to refType should occur
|
||||
{}
|
||||
|
||||
/*! @method get
|
||||
@abstract Explicit conversion to the underlying pointer type
|
||||
@discussion Allows the caller to explicitly get the underlying pointer.
|
||||
*/
|
||||
refType get() const
|
||||
{ return m_ptr; }
|
||||
|
||||
/*! @method operator refType
|
||||
@abstract Implicit conversion to the underlying pointer type
|
||||
@discussion Allows the ref to be used in CF function calls.
|
||||
*/
|
||||
operator refType() const
|
||||
{ return m_ptr; }
|
||||
|
||||
protected:
|
||||
/*! @method wxCFWeakRef
|
||||
@abstract Constructs a weak reference to the raw pointer
|
||||
@templatefield otherType Any type.
|
||||
@param p The raw pointer to assume ownership of. May be NULL.
|
||||
@discussion This method is private so that the friend static_cfref_cast can use it
|
||||
*/
|
||||
template <class otherType>
|
||||
explicit wxCFWeakRef(otherType *p)
|
||||
: m_ptr(p) // Implicit conversion from otherType* to refType should occur.
|
||||
{}
|
||||
|
||||
/*! @var m_ptr The raw pointer.
|
||||
*/
|
||||
refType m_ptr;
|
||||
};
|
||||
|
||||
/*! @class wxCFRef
|
||||
@templatefield refType The CF reference type (e.g. CFStringRef, CFRunLoopRef, etc.)
|
||||
It should already be a pointer. This is different from
|
||||
shared_ptr where the template parameter is the pointee type.
|
||||
@discussion Properly retains/releases reference to CoreFoundation objects
|
||||
*/
|
||||
template <class refType>
|
||||
class wxCFRef
|
||||
{
|
||||
public:
|
||||
/*! @method wxCFRef
|
||||
@abstract Creates a NULL reference
|
||||
*/
|
||||
wxCFRef()
|
||||
: m_ptr(NULL)
|
||||
{}
|
||||
|
||||
/*! @method wxCFRef
|
||||
@abstract Assumes ownership of p and creates a reference to it.
|
||||
@param p The raw core foundation reference to assume ownership of. May be NULL.
|
||||
@discussion Like shared_ptr, it is assumed that the caller has a strong reference to p and intends
|
||||
to transfer ownership of that reference to this ref holder. If the object comes from
|
||||
a Create or Copy method then this is the correct behaviour. If the object comes from
|
||||
a Get method then you must CFRetain it yourself before passing it to this constructor.
|
||||
A handy way to do this is to use the non-member wxCFRefFromGet factory function.
|
||||
*/
|
||||
wxCFRef(refType p) : m_ptr(p)
|
||||
{
|
||||
|
||||
}
|
||||
/*! @method wxCFRef
|
||||
@abstract Assumes ownership of p and creates a reference to it.
|
||||
@templatefield otherType Any type.
|
||||
@param p The raw pointer to assume ownership of. May be NULL.
|
||||
@discussion Like shared_ptr, it is assumed that the caller has a strong reference to p and intends
|
||||
to transfer ownership of that reference to this ref holder. If the object comes from
|
||||
a Create or Copy method then this is the correct behaviour. If the object comes from
|
||||
a Get method then you must CFRetain it yourself before passing it to this constructor.
|
||||
A handy way to do this is to use the non-member wxCFRefFromGet factory function.
|
||||
This method is templated and takes an otherType *p. This prevents implicit conversion
|
||||
using an operator refType() in a different ref-holding class type.
|
||||
*/
|
||||
|
||||
template <class otherType>
|
||||
explicit wxCFRef(otherType *p)
|
||||
: m_ptr(p) // Implicit conversion from otherType* to refType should occur.
|
||||
{}
|
||||
|
||||
/*! @method wxCFRef
|
||||
@abstract Copies a ref holder of the same type
|
||||
@param otherRef The other ref holder to copy.
|
||||
@discussion Ownership will be shared by the original ref and the newly created ref. That is,
|
||||
the object will be explicitly retained by this new ref.
|
||||
*/
|
||||
wxCFRef(const wxCFRef& otherRef)
|
||||
: m_ptr(wxCFRetain(otherRef.m_ptr))
|
||||
{}
|
||||
|
||||
/*! @method wxCFRef
|
||||
@abstract Copies a ref holder where its type can be converted to ours
|
||||
@templatefield otherRefType Any type held by another wxCFRef.
|
||||
@param otherRef The other ref holder to copy.
|
||||
@discussion Ownership will be shared by the original ref and the newly created ref. That is,
|
||||
the object will be explicitly retained by this new ref.
|
||||
*/
|
||||
template <class otherRefType>
|
||||
wxCFRef(const wxCFRef<otherRefType>& otherRef)
|
||||
: m_ptr(wxCFRetain(otherRef.get())) // Implicit conversion from otherRefType to refType should occur
|
||||
{}
|
||||
|
||||
/*! @method wxCFRef
|
||||
@abstract Copies a weak ref holder where its type can be converted to ours
|
||||
@templatefield otherRefType Any type held by a wxCFWeakRef.
|
||||
@param otherRef The weak ref holder to copy.
|
||||
@discussion Ownership will be taken by this newly created ref. That is,
|
||||
the object will be explicitly retained by this new ref.
|
||||
Ownership is most likely shared with some other ref as well.
|
||||
*/
|
||||
template <class otherRefType>
|
||||
wxCFRef(const wxCFWeakRef<otherRefType>& otherRef)
|
||||
: m_ptr(wxCFRetain(otherRef.get())) // Implicit conversion from otherRefType to refType should occur
|
||||
{}
|
||||
|
||||
/*! @method ~wxCFRef
|
||||
@abstract Releases (potentially shared) ownership of the ref.
|
||||
@discussion A ref holder instance is always assumed to have ownership so ownership is always
|
||||
released (CFRelease called) upon destruction.
|
||||
*/
|
||||
~wxCFRef()
|
||||
{ reset(); }
|
||||
|
||||
/*! @method operator=
|
||||
@abstract Assigns the other ref's pointer to us when the otherRef is the same type.
|
||||
@param otherRef The other ref holder to copy.
|
||||
@discussion The incoming pointer is retained, the original pointer is released, and this object
|
||||
is made to point to the new pointer.
|
||||
*/
|
||||
wxCFRef& operator=(const wxCFRef& otherRef)
|
||||
{
|
||||
if (this != &otherRef)
|
||||
{
|
||||
wxCFRetain(otherRef.m_ptr);
|
||||
wxCFRelease(m_ptr);
|
||||
m_ptr = otherRef.m_ptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*! @method operator=
|
||||
@abstract Assigns the other ref's pointer to us when the other ref can be converted to our type.
|
||||
@templatefield otherRefType Any type held by another wxCFRef
|
||||
@param otherRef The other ref holder to copy.
|
||||
@discussion The incoming pointer is retained, the original pointer is released, and this object
|
||||
is made to point to the new pointer.
|
||||
*/
|
||||
template <class otherRefType>
|
||||
wxCFRef& operator=(const wxCFRef<otherRefType>& otherRef)
|
||||
{
|
||||
wxCFRetain(otherRef.get());
|
||||
wxCFRelease(m_ptr);
|
||||
m_ptr = otherRef.get(); // Implicit conversion from otherRefType to refType should occur
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*! @method get
|
||||
@abstract Explicit conversion to the underlying pointer type
|
||||
@discussion Allows the caller to explicitly get the underlying pointer.
|
||||
*/
|
||||
refType get() const
|
||||
{ return m_ptr; }
|
||||
|
||||
/*! @method operator refType
|
||||
@abstract Implicit conversion to the underlying pointer type
|
||||
@discussion Allows the ref to be used in CF function calls.
|
||||
*/
|
||||
operator refType() const
|
||||
{ return m_ptr; }
|
||||
|
||||
#if 0
|
||||
< // HeaderDoc is retarded and thinks the GT from operator-> is part of a template param.
|
||||
// So give it that < outside of a comment to fake it out. (if 0 is not a comment to HeaderDoc)
|
||||
#endif
|
||||
|
||||
/*! @method operator->
|
||||
@abstract Implicit conversion to the underlying pointer type
|
||||
@discussion This is nearly useless for CF types which are nearly always opaque
|
||||
*/
|
||||
refType operator-> () const
|
||||
{ return m_ptr; }
|
||||
|
||||
/*! @method reset
|
||||
@abstract Nullifies the reference
|
||||
@discussion Releases ownership (calls CFRelease) before nullifying the pointer.
|
||||
*/
|
||||
void reset()
|
||||
{
|
||||
wxCFRelease(m_ptr);
|
||||
m_ptr = NULL;
|
||||
}
|
||||
|
||||
/*! @method reset
|
||||
@abstract Sets this to a new reference
|
||||
@templatefield otherType Any type.
|
||||
@param p The raw pointer to assume ownership of
|
||||
@discussion The existing reference is released (like destruction). It is assumed that the caller
|
||||
has a strong reference to the new p and intends to transfer ownership of that reference
|
||||
to this ref holder. Take care to call CFRetain if you received the object from a Get method.
|
||||
This method is templated and takes an otherType *p. This prevents implicit conversion
|
||||
using an operator refType() in a different ref-holding class type.
|
||||
*/
|
||||
template <class otherType>
|
||||
void reset(otherType* p)
|
||||
{
|
||||
wxCFRelease(m_ptr);
|
||||
m_ptr = p; // Automatic conversion should occur
|
||||
}
|
||||
|
||||
// Release the pointer, i.e. give up its ownership.
|
||||
refType release()
|
||||
{
|
||||
refType p = m_ptr;
|
||||
m_ptr = NULL;
|
||||
return p;
|
||||
}
|
||||
|
||||
// Autorelease the pointer, i.e. during the next cleanup it will be released
|
||||
refType autorelease()
|
||||
{
|
||||
refType p = m_ptr;
|
||||
m_ptr = NULL;
|
||||
return wxCFAutorelease(p);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
/*! @var m_ptr The raw pointer.
|
||||
*/
|
||||
refType m_ptr;
|
||||
};
|
||||
|
||||
/*! @function wxCFRefFromGet
|
||||
@abstract Factory function to create wxCFRef from a raw pointer obtained from a Get-rule function
|
||||
@param p The pointer to retain and create a wxCFRef from. May be NULL.
|
||||
@discussion Unlike the wxCFRef raw pointer constructor, this function explicitly retains its
|
||||
argument. This can be used for functions such as CFDictionaryGetValue() or
|
||||
CFAttributedStringGetString() which return a temporary reference (Get-rule functions).
|
||||
FIXME: Anybody got a better name?
|
||||
*/
|
||||
template <typename Type>
|
||||
inline wxCFRef<Type*> wxCFRefFromGet(Type *p)
|
||||
{
|
||||
return wxCFRef<Type*>(wxCFRetain(p));
|
||||
}
|
||||
|
||||
/*! @function static_cfref_cast
|
||||
@abstract Works like static_cast but with a wxCFRef as the argument.
|
||||
@param refType Template parameter. The destination raw pointer type
|
||||
@param otherRef Normal parameter. The source wxCFRef<> object.
|
||||
@discussion This is intended to be a clever way to make static_cast work while allowing
|
||||
the return value to be converted to either a strong ref or a raw pointer
|
||||
while ensuring that the retain count is updated appropriately.
|
||||
|
||||
This is modeled after shared_ptr's static_pointer_cast. Just as wxCFRef is
|
||||
parameterized on a pointer to an opaque type so is this class. Note that
|
||||
this differs from shared_ptr which is parameterized on the pointee type.
|
||||
|
||||
FIXME: Anybody got a better name?
|
||||
*/
|
||||
template <class refType, class otherRefType>
|
||||
inline wxCFWeakRef<refType> static_cfref_cast(const wxCFRef<otherRefType> &otherRef);
|
||||
|
||||
template <class refType, class otherRefType>
|
||||
inline wxCFWeakRef<refType> static_cfref_cast(const wxCFRef<otherRefType> &otherRef)
|
||||
{
|
||||
return wxCFWeakRef<refType>(static_cast<refType>(otherRef.get()));
|
||||
}
|
||||
|
||||
/*! @function CFRelease
|
||||
@abstract Overloads CFRelease so that the user is warned of bad behaviour.
|
||||
@discussion It is rarely appropriate to retain or release a wxCFRef. If one absolutely
|
||||
must do it he can explicitly get() the raw pointer
|
||||
Normally, this function is unimplemented resulting in a linker error if used.
|
||||
*/
|
||||
template <class T>
|
||||
inline void CFRelease(const wxCFRef<T*> & cfref) __AVAILABILITY_INTERNAL_DEPRECATED;
|
||||
|
||||
/*! @function CFRetain
|
||||
@abstract Overloads CFRetain so that the user is warned of bad behaviour.
|
||||
@discussion It is rarely appropriate to retain or release a wxCFRef. If one absolutely
|
||||
must do it he can explicitly get() the raw pointer
|
||||
Normally, this function is unimplemented resulting in a linker error if used.
|
||||
*/
|
||||
template <class T>
|
||||
inline void CFRetain(const wxCFRef<T*>& cfref) __AVAILABILITY_INTERNAL_DEPRECATED;
|
||||
|
||||
// Change the 0 to a 1 if you want the functions to work (no link errors)
|
||||
// Neither function will cause retain/release side-effects if implemented.
|
||||
#if 0
|
||||
template <class T>
|
||||
void CFRelease(const wxCFRef<T*> & cfref)
|
||||
{
|
||||
CFRelease(cfref.get());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void CFRetain(const wxCFRef<T*> & cfref)
|
||||
{
|
||||
CFRetain(cfref.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //ndef _WX_MAC_COREFOUNDATION_CFREF_H__
|
||||
|
||||
103
wxheaders/wx/osx/core/cfstring.h
Normal file
103
wxheaders/wx/osx/core/cfstring.h
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/cfstring.h
|
||||
// Purpose: wxCFStringRef and other string functions
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 2004-10-29 (from code in wx/mac/carbon/private.h)
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
// Usage: Darwin (base library)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_CFSTRINGHOLDER_H__
|
||||
#define __WX_CFSTRINGHOLDER_H__
|
||||
|
||||
#include "wx/dlimpexp.h"
|
||||
#include "wx/fontenc.h"
|
||||
#include "wx/osx/core/cfref.h"
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define kCFStringEncodingUTF32Native kCFStringEncodingUTF32BE
|
||||
#else
|
||||
#define kCFStringEncodingUTF32Native kCFStringEncodingUTF32LE
|
||||
#endif
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
|
||||
WXDLLIMPEXP_BASE wxString wxMacConvertNewlines13To10(const wxString& data);
|
||||
WXDLLIMPEXP_BASE wxString wxMacConvertNewlines10To13(const wxString& data);
|
||||
|
||||
WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
|
||||
WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
|
||||
WXDLLIMPEXP_BASE void wxMacWakeUp() ;
|
||||
|
||||
class WXDLLIMPEXP_BASE wxCFStringRef : public wxCFRef< CFStringRef >
|
||||
{
|
||||
public:
|
||||
wxCFStringRef()
|
||||
{
|
||||
}
|
||||
|
||||
wxCFStringRef(const wxString &str,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ;
|
||||
|
||||
#ifdef __OBJC__
|
||||
wxCFStringRef(WX_NSString ref)
|
||||
: wxCFRef< CFStringRef >((WX_OSX_BRIDGE_RETAINED CFStringRef) ref)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
wxCFStringRef(CFStringRef ref)
|
||||
: wxCFRef< CFStringRef >(ref)
|
||||
{
|
||||
}
|
||||
|
||||
wxCFStringRef(const wxCFStringRef& otherRef )
|
||||
: wxCFRef< CFStringRef >(otherRef)
|
||||
{
|
||||
}
|
||||
|
||||
~wxCFStringRef()
|
||||
{
|
||||
}
|
||||
|
||||
wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) const;
|
||||
|
||||
static wxString AsString( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
|
||||
static wxString AsStringWithNormalizationFormC( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
|
||||
#ifdef __WXMAC__
|
||||
static wxString AsString( WX_NSString ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
|
||||
static wxString AsStringWithNormalizationFormC( WX_NSString ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
|
||||
#endif
|
||||
#ifdef __OBJC__
|
||||
WX_NSString AsNSString() const { return (WX_OSX_BRIDGE WX_NSString)(CFStringRef) *this; }
|
||||
#endif
|
||||
private:
|
||||
} ;
|
||||
|
||||
/*! @function wxCFStringRefFromGet
|
||||
@abstract Factory function to create wxCFStringRefRef from a CFStringRef obtained from a Get-rule function
|
||||
@param p The CFStringRef to retain and create a wxCFStringRefRef from. May be NULL.
|
||||
@discussion Unlike the wxCFStringRef raw pointer constructor, this function explicitly retains its
|
||||
argument. This can be used for functions ) which return a temporary reference (Get-rule functions).
|
||||
*/
|
||||
inline wxCFStringRef wxCFStringRefFromGet(CFStringRef p)
|
||||
{
|
||||
return wxCFStringRef(wxCFRetain(p));
|
||||
}
|
||||
|
||||
#ifdef __WXMAC__
|
||||
/*! @function wxCFStringRefFromGet
|
||||
@abstract Factory function to create wxCFStringRefRef from a NSString* obtained from a Get-rule function
|
||||
@param p The NSString pointer to retain and create a wxCFStringRefRef from. May be NULL.
|
||||
@discussion Unlike the wxCFStringRef raw pointer constructor, this function explicitly retains its
|
||||
argument. This can be used for functions ) which return a temporary reference (Get-rule functions).
|
||||
*/
|
||||
inline wxCFStringRef wxCFStringRefFromGet(NSString *p)
|
||||
{
|
||||
return wxCFStringRefFromGet((WX_OSX_BRIDGE CFStringRef)p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //__WXCFSTRINGHOLDER_H__
|
||||
130
wxheaders/wx/osx/core/cftype.h
Normal file
130
wxheaders/wx/osx/core/cftype.h
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/cftype.h
|
||||
// Purpose: wxCFDictionaryRef class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 2018/07/27
|
||||
// Copyright: (c) 2018 Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*! @header wx/osx/core/cftype.h
|
||||
@abstract wxCFTypeRef class and derived classes
|
||||
*/
|
||||
|
||||
#ifndef _WX_OSX_COREFOUNDATION_CFTYPEREF_H__
|
||||
#define _WX_OSX_COREFOUNDATION_CFTYPEREF_H__
|
||||
|
||||
#include "wx/osx/core/cfref.h"
|
||||
#include "wx/osx/core/cfstring.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#endif
|
||||
|
||||
class wxCFTypeRef : public wxCFRef<CFTypeRef>
|
||||
{
|
||||
public:
|
||||
typedef wxCFRef<CFTypeRef> super_type;
|
||||
|
||||
wxCFTypeRef(CFTypeRef d)
|
||||
: super_type(d)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
bool GetValue(V* ptr) const;
|
||||
|
||||
template <typename V>
|
||||
bool GetValue(V* ptr, V defaultValue) const
|
||||
{
|
||||
bool hasKey = GetValue(ptr);
|
||||
|
||||
if (!hasKey)
|
||||
*ptr = defaultValue;
|
||||
|
||||
return hasKey;
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
bool GetValue(V& ref) const
|
||||
{
|
||||
return GetValue(&ref);
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
bool GetValue(V& ref, V defaultValue) const
|
||||
{
|
||||
bool hasKey = GetValue(ref);
|
||||
|
||||
if (!hasKey)
|
||||
ref = defaultValue;
|
||||
|
||||
return hasKey;
|
||||
}
|
||||
|
||||
// spezialization through overload
|
||||
|
||||
bool GetValue(CGFloat* ptr) const
|
||||
{
|
||||
if (m_ptr)
|
||||
CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberCGFloatType, ptr);
|
||||
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
bool GetValue(int32_t* ptr) const
|
||||
{
|
||||
if (m_ptr)
|
||||
CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberSInt32Type, ptr);
|
||||
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
bool GetValue(uint32_t* ptr) const
|
||||
{
|
||||
if (m_ptr)
|
||||
CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberSInt32Type, ptr);
|
||||
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
bool GetValue(int64_t* ptr) const
|
||||
{
|
||||
if (m_ptr)
|
||||
CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberSInt64Type, ptr);
|
||||
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
bool GetValue(uint64_t* ptr) const
|
||||
{
|
||||
if (m_ptr)
|
||||
CFNumberGetValue((CFNumberRef)m_ptr, kCFNumberSInt64Type, ptr);
|
||||
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
bool GetValue(wxString* s) const
|
||||
{
|
||||
if (m_ptr)
|
||||
*s = wxCFStringRef::AsString((CFStringRef)m_ptr);
|
||||
|
||||
return m_ptr;
|
||||
}
|
||||
};
|
||||
|
||||
class wxCFNumberRef : public wxCFTypeRef
|
||||
{
|
||||
public:
|
||||
wxCFNumberRef(CGFloat v)
|
||||
: wxCFTypeRef(CFNumberCreate(NULL, kCFNumberCGFloatType, &v))
|
||||
{
|
||||
}
|
||||
|
||||
wxCFNumberRef(int v)
|
||||
: wxCFTypeRef(CFNumberCreate(NULL, kCFNumberIntType, &v))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif //ifndef _WX_OSX_COREFOUNDATION_CFTYPEREF_H__
|
||||
109
wxheaders/wx/osx/core/colour.h
Normal file
109
wxheaders/wx/osx/core/colour.h
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/colour.h
|
||||
// Purpose: wxColour class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 1998-01-01
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COLOUR_H_
|
||||
#define _WX_COLOUR_H_
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
#include "wx/osx/core/cfref.h"
|
||||
|
||||
struct RGBColor;
|
||||
|
||||
// Colour
|
||||
class WXDLLIMPEXP_CORE wxColour: public wxColourBase
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
// default copy ctor and dtor are ok
|
||||
|
||||
// accessors
|
||||
virtual ChannelType Red() const wxOVERRIDE;
|
||||
virtual ChannelType Green() const wxOVERRIDE;
|
||||
virtual ChannelType Blue() const wxOVERRIDE;
|
||||
virtual ChannelType Alpha() const wxOVERRIDE;
|
||||
|
||||
virtual bool IsSolid() const wxOVERRIDE;
|
||||
|
||||
// comparison
|
||||
bool operator == (const wxColour& colour) const;
|
||||
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
||||
|
||||
// CoreGraphics CGColor
|
||||
// --------------------
|
||||
|
||||
// This ctor does take ownership of the color.
|
||||
wxColour( CGColorRef col );
|
||||
|
||||
// don't take ownership of the returned value
|
||||
CGColorRef GetCGColor() const;
|
||||
|
||||
// do take ownership of the returned value
|
||||
CGColorRef CreateCGColor() const { return wxCFRetain(GetCGColor()); }
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
// Quickdraw RGBColor
|
||||
// ------------------
|
||||
wxColour(const RGBColor& col);
|
||||
void GetRGBColor( RGBColor *col ) const;
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
// NSColor Cocoa
|
||||
// -------------
|
||||
|
||||
// This ctor does not take ownership of the color.
|
||||
explicit wxColour(WX_NSColor color);
|
||||
WX_NSColor OSXGetNSColor() const;
|
||||
WX_NSImage OSXGetNSPatternImage() const;
|
||||
#endif
|
||||
|
||||
protected :
|
||||
virtual void
|
||||
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) wxOVERRIDE;
|
||||
|
||||
virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE;
|
||||
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxColour);
|
||||
};
|
||||
|
||||
class wxColourRefData : public wxGDIRefData
|
||||
{
|
||||
public:
|
||||
wxColourRefData() {}
|
||||
virtual ~wxColourRefData() {}
|
||||
|
||||
virtual double Red() const = 0;
|
||||
virtual double Green() const = 0;
|
||||
virtual double Blue() const = 0;
|
||||
virtual double Alpha() const = 0;
|
||||
|
||||
virtual bool IsSolid() const
|
||||
{ return true; }
|
||||
|
||||
virtual CGColorRef GetCGColor() const = 0;
|
||||
|
||||
virtual wxColourRefData* Clone() const = 0;
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
virtual WX_NSColor GetNSColor() const;
|
||||
virtual WX_NSImage GetNSPatternImage() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_COLOUR_H_
|
||||
117
wxheaders/wx/osx/core/dataview.h
Normal file
117
wxheaders/wx/osx/core/dataview.h
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/dataview.h
|
||||
// Purpose: wxDataViewCtrl native implementation header for OSX
|
||||
// Author:
|
||||
// Copyright: (c) 2009
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DATAVIEWCTRL_CORE_H_
|
||||
#define _WX_DATAVIEWCTRL_CORE_H_
|
||||
|
||||
#include "wx/dataview.h"
|
||||
|
||||
typedef wxWidgetImpl wxWidgetImplType;
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// Helper functions for dataview implementation on OSX
|
||||
// ---------------------------------------------------------
|
||||
wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID id,
|
||||
wxPoint const& pos, wxSize const& size,
|
||||
long style, long extraStyle);
|
||||
wxString ConcatenateDataViewItemValues(wxDataViewCtrl const* dataViewCtrlPtr, wxDataViewItem const& dataViewItem); // concatenates all data of the visible columns of the passed control
|
||||
// and item TAB separated into a string and returns it
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewWidgetImpl
|
||||
// Common interface of the native dataview implementation
|
||||
// for the carbon and cocoa environment.
|
||||
// ATTENTION
|
||||
// All methods assume that the passed column pointers are
|
||||
// valid (unless a NULL pointer is explicitly allowed
|
||||
// to be passed)!
|
||||
// ATTENTION
|
||||
// ---------------------------------------------------------
|
||||
class WXDLLIMPEXP_CORE wxDataViewWidgetImpl
|
||||
{
|
||||
public:
|
||||
//
|
||||
// constructors / destructor
|
||||
//
|
||||
virtual ~wxDataViewWidgetImpl()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// column related methods
|
||||
//
|
||||
virtual bool ClearColumns() = 0; // deletes all columns in the native control
|
||||
virtual bool DeleteColumn (wxDataViewColumn* columnPtr) = 0; // deletes the column in the native control
|
||||
virtual void DoSetExpanderColumn(wxDataViewColumn const* columnPtr) = 0; // sets the disclosure column in the native control
|
||||
virtual wxDataViewColumn* GetColumn (unsigned int pos) const = 0; // returns the column belonging to 'pos' in the native control
|
||||
virtual int GetColumnPosition (wxDataViewColumn const* columnPtr) const = 0; // returns the position of the passed column in the native control
|
||||
virtual bool InsertColumn (unsigned int pos, wxDataViewColumn* columnPtr) = 0; // inserts a column at pos in the native control;
|
||||
// the method can assume that the column's owner is already set
|
||||
virtual void FitColumnWidthToContent(unsigned int pos) = 0; // resizes column to fit its content
|
||||
|
||||
//
|
||||
// item related methods
|
||||
//
|
||||
virtual bool Add (wxDataViewItem const& parent, wxDataViewItem const& item) = 0; // adds an item to the native control
|
||||
virtual bool Add (wxDataViewItem const& parent, wxDataViewItemArray const& items) = 0; // adds items to the native control
|
||||
virtual void Collapse (wxDataViewItem const& item) = 0; // collapses the passed item in the native control
|
||||
virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // ensures that the passed item's value in the passed column is visible (column pointer can be NULL)
|
||||
virtual unsigned int GetCount() const = 0; // returns the number of items in the native control
|
||||
virtual int GetCountPerPage() const = 0; // get number of items that fit into a single page
|
||||
virtual wxRect GetRectangle (wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // returns the rectangle that is used by the passed item and column in the native control
|
||||
virtual wxDataViewItem GetTopItem() const = 0; // get top-most visible item
|
||||
virtual bool IsExpanded (wxDataViewItem const& item) const = 0; // checks if the passed item is expanded in the native control
|
||||
virtual bool Reload() = 0; // clears the native control and reloads all data
|
||||
virtual bool Remove (wxDataViewItem const& parent) = 0; // removes one or more items under the given parent from the native control
|
||||
virtual bool Update (wxDataViewColumn const* columnPtr) = 0; // updates the items in the passed column of the native control
|
||||
virtual bool Update (wxDataViewItem const& parent, wxDataViewItem const& item) = 0; // updates the passed item in the native control
|
||||
virtual bool Update (wxDataViewItem const& parent, wxDataViewItemArray const& items) = 0; // updates the passed items in the native control
|
||||
|
||||
//
|
||||
// model related methods
|
||||
//
|
||||
virtual bool AssociateModel(wxDataViewModel* model) = 0; // informs the native control that a model is present
|
||||
|
||||
//
|
||||
// selection related methods
|
||||
//
|
||||
virtual wxDataViewItem GetCurrentItem() const = 0;
|
||||
virtual void SetCurrentItem(const wxDataViewItem& item) = 0;
|
||||
|
||||
virtual wxDataViewColumn *GetCurrentColumn() const = 0;
|
||||
|
||||
virtual int GetSelectedItemsCount() const = 0;
|
||||
virtual int GetSelections(wxDataViewItemArray& sel) const = 0; // returns all selected items in the native control
|
||||
virtual bool IsSelected (wxDataViewItem const& item) const = 0; // checks if the passed item is selected in the native control
|
||||
virtual void Select (wxDataViewItem const& item) = 0; // selects the passed item in the native control
|
||||
virtual void Select (wxDataViewItemArray const& items) = 0; // selects the passed items in the native control
|
||||
virtual void SelectAll() = 0; // selects all items in the native control
|
||||
virtual void Unselect (wxDataViewItem const& item) = 0; // unselects the passed item in the native control
|
||||
virtual void UnselectAll() = 0; // unselects all items in the native control
|
||||
|
||||
//
|
||||
// sorting related methods
|
||||
//
|
||||
virtual wxDataViewColumn* GetSortingColumn() const = 0; // returns the column that is primarily responsible for sorting in the native control
|
||||
virtual void Resort() = 0; // asks the native control to start a resorting process
|
||||
|
||||
//
|
||||
// other methods
|
||||
//
|
||||
virtual void DoSetIndent (int indent) = 0; // sets the indentation in the native control
|
||||
virtual void DoExpand (wxDataViewItem const& item, bool expandChildren) = 0; // expands the passed item in the native control
|
||||
|
||||
virtual void HitTest (wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const = 0; // return the item and column pointer that contains with the passed point
|
||||
virtual void SetRowHeight(int height) = 0; // sets the height of all rows
|
||||
virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height) = 0; // sets the height of the row containing the passed item in the native control
|
||||
virtual void OnSize() = 0; // updates the layout of the native control after a size event
|
||||
virtual void StartEditor( const wxDataViewItem & item, unsigned int column ) = 0; // starts editing the passed in item and column
|
||||
};
|
||||
|
||||
#endif // _WX_DATAVIEWCTRL_CORE_H_
|
||||
118
wxheaders/wx/osx/core/evtloop.h
Normal file
118
wxheaders/wx/osx/core/evtloop.h
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/evtloop.h
|
||||
// Purpose: CoreFoundation-based event loop
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 2006-01-12
|
||||
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_CORE_EVTLOOP_H_
|
||||
#define _WX_OSX_CORE_EVTLOOP_H_
|
||||
|
||||
DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoop )
|
||||
DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopObserver )
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxCFEventLoopPauseIdleEvents;
|
||||
|
||||
class WXDLLIMPEXP_BASE wxCFEventLoop : public wxEventLoopBase
|
||||
{
|
||||
friend class wxCFEventLoopPauseIdleEvents;
|
||||
public:
|
||||
wxCFEventLoop();
|
||||
virtual ~wxCFEventLoop();
|
||||
|
||||
// sets the "should exit" flag and wakes up the loop so that it terminates
|
||||
// soon
|
||||
virtual void ScheduleExit(int rc = 0) wxOVERRIDE;
|
||||
|
||||
// return true if any events are available
|
||||
virtual bool Pending() const wxOVERRIDE;
|
||||
|
||||
// dispatch a single event, return false if we should exit from the loop
|
||||
virtual bool Dispatch() wxOVERRIDE;
|
||||
|
||||
// same as Dispatch() but doesn't wait for longer than the specified (in
|
||||
// ms) timeout, return true if an event was processed, false if we should
|
||||
// exit the loop or -1 if timeout expired
|
||||
virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE;
|
||||
|
||||
// implement this to wake up the loop: usually done by posting a dummy event
|
||||
// to it (can be called from non main thread)
|
||||
virtual void WakeUp() wxOVERRIDE;
|
||||
|
||||
bool ShouldProcessIdleEvents() const { return m_processIdleEvents ; }
|
||||
|
||||
#if wxUSE_UIACTIONSIMULATOR
|
||||
// notifies Yield and Dispatch to wait for at least one event before
|
||||
// returning, this is necessary, because the synthesized events need to be
|
||||
// converted by the OS before being available on the native event queue
|
||||
void SetShouldWaitForEvent(bool should) { m_shouldWaitForEvent = should; }
|
||||
#endif
|
||||
protected:
|
||||
// enters a loop calling OnNextIteration(), Pending() and Dispatch() and
|
||||
// terminating when Exit() is called
|
||||
virtual int DoRun() wxOVERRIDE;
|
||||
|
||||
// may be overridden to perform some action at the start of each new event
|
||||
// loop iteration
|
||||
virtual void OnNextIteration() {}
|
||||
|
||||
virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE;
|
||||
|
||||
void CommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity);
|
||||
void DefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity);
|
||||
|
||||
// set to false to avoid idling at unexpected moments - eg when having native message boxes
|
||||
void SetProcessIdleEvents(bool process) { m_processIdleEvents = process; }
|
||||
|
||||
static void OSXCommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info);
|
||||
static void OSXDefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info);
|
||||
|
||||
// get the currently executing CFRunLoop
|
||||
virtual CFRunLoopRef CFGetCurrentRunLoop() const;
|
||||
|
||||
virtual int DoDispatchTimeout(unsigned long timeout);
|
||||
|
||||
virtual void OSXDoRun();
|
||||
virtual void OSXDoStop();
|
||||
|
||||
// the loop exit code
|
||||
int m_exitcode;
|
||||
|
||||
// cfrunloop
|
||||
CFRunLoopRef m_runLoop;
|
||||
|
||||
// common modes runloop observer
|
||||
CFRunLoopObserverRef m_commonModeRunLoopObserver;
|
||||
|
||||
// default mode runloop observer
|
||||
CFRunLoopObserverRef m_defaultModeRunLoopObserver;
|
||||
|
||||
// set to false to avoid idling at unexpected moments - eg when having native message boxes
|
||||
bool m_processIdleEvents;
|
||||
|
||||
#if wxUSE_UIACTIONSIMULATOR
|
||||
bool m_shouldWaitForEvent;
|
||||
#endif
|
||||
private:
|
||||
// process all already pending events and dispatch a new one (blocking
|
||||
// until it appears in the event queue if necessary)
|
||||
//
|
||||
// returns the return value of DoDispatchTimeout()
|
||||
int DoProcessEvents();
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxCFEventLoop);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxCFEventLoopPauseIdleEvents : public wxObject
|
||||
{
|
||||
public:
|
||||
wxCFEventLoopPauseIdleEvents();
|
||||
virtual ~wxCFEventLoopPauseIdleEvents();
|
||||
private:
|
||||
bool m_formerState;
|
||||
};
|
||||
|
||||
#endif // _WX_OSX_EVTLOOP_H_
|
||||
114
wxheaders/wx/osx/core/hid.h
Normal file
114
wxheaders/wx/osx/core/hid.h
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/hid.h
|
||||
// Purpose: DARWIN HID layer for WX
|
||||
// Author: Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 11/11/2003
|
||||
// Copyright: (c) Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ===========================================================================
|
||||
// declarations
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef _WX_MACCARBONHID_H_
|
||||
#define _WX_MACCARBONHID_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
//Mac OSX only
|
||||
#ifdef __DARWIN__
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/IOCFPlugIn.h>
|
||||
#include <IOKit/hid/IOHIDLib.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
|
||||
|
||||
//Darn apple - doesn't properly wrap their headers in extern "C"!
|
||||
//http://www.macosx.com/forums/archive/index.php/t-68069.html
|
||||
extern "C" {
|
||||
#include <mach/mach_port.h>
|
||||
}
|
||||
|
||||
#include <mach/mach.h> //this actually includes mach_port.h (see above)
|
||||
|
||||
// ===========================================================================
|
||||
// definitions
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxHIDDevice
|
||||
//
|
||||
// A wrapper around OS X HID Manager procedures.
|
||||
// The tutorial "Working With HID Class Device Interfaces" Is
|
||||
// Quite good, as is the sample program associated with it
|
||||
// (Depite the author's protests!).
|
||||
// ---------------------------------------------------------------------------
|
||||
class WXDLLIMPEXP_CORE wxHIDDevice
|
||||
{
|
||||
public:
|
||||
wxHIDDevice() : m_ppDevice(NULL), m_ppQueue(NULL), m_pCookies(NULL) {}
|
||||
|
||||
bool Create (int nClass = -1, int nType = -1, int nDev = 1);
|
||||
|
||||
static size_t GetCount(int nClass = -1, int nType = -1);
|
||||
|
||||
void AddCookie(CFTypeRef Data, int i);
|
||||
void AddCookieInQueue(CFTypeRef Data, int i);
|
||||
void InitCookies(size_t dwSize, bool bQueue = false);
|
||||
|
||||
//Must be implemented by derived classes
|
||||
//builds the cookie array -
|
||||
//first call InitCookies to initialize the cookie
|
||||
//array, then AddCookie to add a cookie at a certain point in an array
|
||||
virtual void BuildCookies(CFArrayRef Array) = 0;
|
||||
|
||||
//checks to see whether the cookie at nIndex is active (element value != 0)
|
||||
bool IsActive(int nIndex);
|
||||
|
||||
//checks to see whether an element in the internal cookie array
|
||||
//exists
|
||||
bool HasElement(int nIndex);
|
||||
|
||||
//closes the device and cleans the queue and cookies
|
||||
virtual ~wxHIDDevice();
|
||||
|
||||
protected:
|
||||
IOHIDDeviceInterface** m_ppDevice; //this, essentially
|
||||
IOHIDQueueInterface** m_ppQueue; //queue (if we want one)
|
||||
IOHIDElementCookie* m_pCookies; //cookies
|
||||
|
||||
wxString m_szProductName; //product name
|
||||
int m_nProductId; //product id
|
||||
int m_nManufacturerId; //manufacturer id
|
||||
mach_port_t m_pPort; //mach port to use
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxHIDKeyboard
|
||||
//
|
||||
// Semi-simple implementation that opens a connection to the first
|
||||
// keyboard of the machine. Used in wxGetKeyState.
|
||||
// ---------------------------------------------------------------------------
|
||||
class WXDLLIMPEXP_CORE wxHIDKeyboard : public wxHIDDevice
|
||||
{
|
||||
public:
|
||||
static int GetCount();
|
||||
bool Create(int nDev = 1);
|
||||
void AddCookie(CFTypeRef Data, int i);
|
||||
virtual void BuildCookies(CFArrayRef Array) wxOVERRIDE;
|
||||
void DoBuildCookies(CFArrayRef Array);
|
||||
};
|
||||
|
||||
#endif //__DARWIN__
|
||||
|
||||
#endif
|
||||
// _WX_MACCARBONHID_H_
|
||||
92
wxheaders/wx/osx/core/joystick.h
Normal file
92
wxheaders/wx/osx/core/joystick.h
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/joystick.h
|
||||
// Purpose: wxJoystick class
|
||||
// Author: Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 2/13/2005
|
||||
// Copyright: (c) Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_JOYSTICK_H_
|
||||
#define _WX_JOYSTICK_H_
|
||||
|
||||
#include "wx/event.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxJoystickThread;
|
||||
|
||||
class WXDLLIMPEXP_ADV wxJoystick: public wxObject
|
||||
{
|
||||
wxDECLARE_DYNAMIC_CLASS(wxJoystick);
|
||||
public:
|
||||
|
||||
wxJoystick(int joystick = wxJOYSTICK1);
|
||||
virtual ~wxJoystick();
|
||||
|
||||
// Attributes
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxPoint GetPosition() const;
|
||||
int GetPosition(unsigned axis) const;
|
||||
bool GetButtonState(unsigned button) const;
|
||||
int GetZPosition() const;
|
||||
int GetButtonState() const;
|
||||
int GetPOVPosition() const;
|
||||
int GetPOVCTSPosition() const;
|
||||
int GetRudderPosition() const;
|
||||
int GetUPosition() const;
|
||||
int GetVPosition() const;
|
||||
int GetMovementThreshold() const;
|
||||
void SetMovementThreshold(int threshold) ;
|
||||
|
||||
// Capabilities
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool IsOk() const; // Checks that the joystick is functioning
|
||||
static int GetNumberJoysticks() ;
|
||||
int GetManufacturerId() const ;
|
||||
int GetProductId() const ;
|
||||
wxString GetProductName() const ;
|
||||
int GetXMin() const;
|
||||
int GetYMin() const;
|
||||
int GetZMin() const;
|
||||
int GetXMax() const;
|
||||
int GetYMax() const;
|
||||
int GetZMax() const;
|
||||
int GetNumberButtons() const;
|
||||
int GetNumberAxes() const;
|
||||
int GetMaxButtons() const;
|
||||
int GetMaxAxes() const;
|
||||
int GetPollingMin() const;
|
||||
int GetPollingMax() const;
|
||||
int GetRudderMin() const;
|
||||
int GetRudderMax() const;
|
||||
int GetUMin() const;
|
||||
int GetUMax() const;
|
||||
int GetVMin() const;
|
||||
int GetVMax() const;
|
||||
|
||||
bool HasRudder() const;
|
||||
bool HasZ() const;
|
||||
bool HasU() const;
|
||||
bool HasV() const;
|
||||
bool HasPOV() const;
|
||||
bool HasPOV4Dir() const;
|
||||
bool HasPOVCTS() const;
|
||||
|
||||
// Operations
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// pollingFreq = 0 means that movement events are sent when above the threshold.
|
||||
// If pollingFreq > 0, events are received every this many milliseconds.
|
||||
bool SetCapture(wxWindow* win, int pollingFreq = 0);
|
||||
bool ReleaseCapture();
|
||||
|
||||
protected:
|
||||
int m_joystick;
|
||||
wxJoystickThread* m_thread;
|
||||
class wxHIDJoystick* m_hid;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_JOYSTICK_H_
|
||||
123
wxheaders/wx/osx/core/mimetype.h
Normal file
123
wxheaders/wx/osx/core/mimetype.h
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/mimetype.h
|
||||
// Purpose: Mac implementation for wx mime-related classes
|
||||
// Author: Neil Perkins
|
||||
// Modified by:
|
||||
// Created: 2010-05-15
|
||||
// Copyright: (C) 2010 Neil Perkins
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MIMETYPE_IMPL_H
|
||||
#define _MIMETYPE_IMPL_H
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_MIMETYPE
|
||||
|
||||
#include "wx/mimetype.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/iconloc.h"
|
||||
|
||||
|
||||
// This class implements mime type functionality for Mac OS X using UTIs and Launch Services
|
||||
// Currently only the GetFileTypeFromXXXX public functions have been implemented
|
||||
class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl
|
||||
{
|
||||
public:
|
||||
|
||||
wxMimeTypesManagerImpl();
|
||||
virtual ~wxMimeTypesManagerImpl();
|
||||
|
||||
// These functions are not needed on Mac OS X and have no-op implementations
|
||||
void Initialize(int mailcapStyles = wxMAILCAP_STANDARD, const wxString& extraDir = wxEmptyString);
|
||||
void ClearData();
|
||||
|
||||
// Functions to look up types by ext, mime or UTI
|
||||
wxFileType *GetFileTypeFromExtension(const wxString& ext);
|
||||
wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
|
||||
wxFileType *GetFileTypeFromUti(const wxString& uti);
|
||||
|
||||
// These functions are only stubs on Mac OS X
|
||||
size_t EnumAllFileTypes(wxArrayString& mimetypes);
|
||||
wxFileType *Associate(const wxFileTypeInfo& ftInfo);
|
||||
bool Unassociate(wxFileType *ft);
|
||||
|
||||
private:
|
||||
|
||||
// The work of querying the OS for type data is done in these two functions
|
||||
void LoadTypeDataForUti(const wxString& uti);
|
||||
void LoadDisplayDataForUti(const wxString& uti);
|
||||
|
||||
// These functions are pass-throughs from wxFileTypeImpl
|
||||
bool GetExtensions(const wxString& uti, wxArrayString& extensions);
|
||||
bool GetMimeType(const wxString& uti, wxString *mimeType);
|
||||
bool GetMimeTypes(const wxString& uti, wxArrayString& mimeTypes);
|
||||
bool GetIcon(const wxString& uti, wxIconLocation *iconLoc);
|
||||
bool GetDescription(const wxString& uti, wxString *desc);
|
||||
bool GetApplication(const wxString& uti, wxString *command);
|
||||
|
||||
// Structure to represent file types
|
||||
typedef struct FileTypeData
|
||||
{
|
||||
wxArrayString extensions;
|
||||
wxArrayString mimeTypes;
|
||||
wxIconLocation iconLoc;
|
||||
wxString application;
|
||||
wxString description;
|
||||
}
|
||||
FileTypeInfo;
|
||||
|
||||
// Map types
|
||||
WX_DECLARE_STRING_HASH_MAP( wxString, TagMap );
|
||||
WX_DECLARE_STRING_HASH_MAP( FileTypeData, UtiMap );
|
||||
|
||||
// Data store
|
||||
TagMap m_extMap;
|
||||
TagMap m_mimeMap;
|
||||
UtiMap m_utiMap;
|
||||
|
||||
friend class wxFileTypeImpl;
|
||||
};
|
||||
|
||||
|
||||
// This class provides the interface between wxFileType and wxMimeTypesManagerImple for Mac OS X
|
||||
// Currently only extension, mimetype, description and icon information is available
|
||||
// All other methods have no-op implementation
|
||||
class WXDLLIMPEXP_BASE wxFileTypeImpl
|
||||
{
|
||||
public:
|
||||
|
||||
wxFileTypeImpl();
|
||||
virtual ~wxFileTypeImpl();
|
||||
|
||||
bool GetExtensions(wxArrayString& extensions) const ;
|
||||
bool GetMimeType(wxString *mimeType) const ;
|
||||
bool GetMimeTypes(wxArrayString& mimeTypes) const ;
|
||||
bool GetIcon(wxIconLocation *iconLoc) const ;
|
||||
bool GetDescription(wxString *desc) const ;
|
||||
bool GetOpenCommand(wxString *openCmd, const wxFileType::MessageParameters& params) const;
|
||||
|
||||
// These functions are only stubs on Mac OS X
|
||||
bool GetPrintCommand(wxString *printCmd, const wxFileType::MessageParameters& params) const;
|
||||
size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands, const wxFileType::MessageParameters& params) const;
|
||||
bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE);
|
||||
bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0);
|
||||
bool Unassociate(wxFileType *ft);
|
||||
|
||||
wxString
|
||||
GetExpandedCommand(const wxString& verb,
|
||||
const wxFileType::MessageParameters& params) const;
|
||||
private:
|
||||
|
||||
// All that is needed to query type info - UTI and pointer to the manager
|
||||
wxString m_uti;
|
||||
wxMimeTypesManagerImpl* m_manager;
|
||||
|
||||
friend class wxMimeTypesManagerImpl;
|
||||
};
|
||||
|
||||
#endif // wxUSE_MIMETYPE
|
||||
#endif //_MIMETYPE_IMPL_H
|
||||
|
||||
|
||||
23
wxheaders/wx/osx/core/objcid.h
Normal file
23
wxheaders/wx/osx/core/objcid.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/objcid.h
|
||||
// Purpose: Define wxObjCID working in both C++ and Objective-C.
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2012-05-20
|
||||
// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_CORE_OBJCID_H_
|
||||
#define _WX_OSX_CORE_OBJCID_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxObjCID: Equivalent of Objective-C "id" that works in C++ code.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __OBJC__
|
||||
#define wxObjCID id
|
||||
#else
|
||||
typedef struct objc_object* wxObjCID;
|
||||
#endif
|
||||
|
||||
#endif // _WX_OSX_CORE_OBJCID_H_
|
||||
1129
wxheaders/wx/osx/core/private.h
Normal file
1129
wxheaders/wx/osx/core/private.h
Normal file
File diff suppressed because it is too large
Load diff
64
wxheaders/wx/osx/core/private/datetimectrl.h
Normal file
64
wxheaders/wx/osx/core/private/datetimectrl.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/private/datetime.h
|
||||
// Purpose:
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2011-12-19
|
||||
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_
|
||||
#define _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_
|
||||
|
||||
#if wxUSE_DATEPICKCTRL
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
#include "wx/datetime.h"
|
||||
|
||||
enum wxDateTimeWidgetKind
|
||||
{
|
||||
wxDateTimeWidget_YearMonthDay,
|
||||
wxDateTimeWidget_HourMinuteSecond
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDateTimeWidgetImpl: peer class for wxDateTimePickerCtrl.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxDateTimeWidgetImpl
|
||||
#if wxOSX_USE_COCOA
|
||||
: public wxWidgetCocoaImpl
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
static wxDateTimeWidgetImpl*
|
||||
CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer,
|
||||
const wxDateTime& dt,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
wxDateTimeWidgetKind kind);
|
||||
|
||||
virtual void SetDateTime(const wxDateTime& dt) = 0;
|
||||
virtual wxDateTime GetDateTime() const = 0;
|
||||
|
||||
virtual void SetDateRange(const wxDateTime& dt1, const wxDateTime& dt2) = 0;
|
||||
virtual bool GetDateRange(wxDateTime* dt1, wxDateTime* dt2) = 0;
|
||||
|
||||
virtual ~wxDateTimeWidgetImpl() { }
|
||||
|
||||
protected:
|
||||
#if wxOSX_USE_COCOA
|
||||
wxDateTimeWidgetImpl(wxDateTimePickerCtrl* wxpeer, WXWidget view)
|
||||
: wxWidgetCocoaImpl(wxpeer, view)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // wxUSE_DATEPICKCTRL
|
||||
|
||||
#endif // _WX_OSX_CORE_PRIVATE_DATETIMECTRL_H_
|
||||
374
wxheaders/wx/osx/core/private/strconv_cf.h
Normal file
374
wxheaders/wx/osx/core/private/strconv_cf.h
Normal file
|
|
@ -0,0 +1,374 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/private/strconv_cf.h
|
||||
// Purpose: Unicode conversion classes
|
||||
// Author: David Elliott, Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 2007-07-06
|
||||
// Copyright: (c) 2004 Ryan Norton
|
||||
// (c) 2007 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/strconv.h"
|
||||
|
||||
#include <CoreFoundation/CFString.h>
|
||||
#include <CoreFoundation/CFStringEncodingExt.h>
|
||||
#include "wx/fontmap.h"
|
||||
|
||||
// ============================================================================
|
||||
// CoreFoundation conversion classes
|
||||
// ============================================================================
|
||||
|
||||
inline CFStringEncoding wxCFStringEncFromFontEnc(wxFontEncoding encoding)
|
||||
{
|
||||
CFStringEncoding enc = kCFStringEncodingInvalidId ;
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
case wxFONTENCODING_DEFAULT :
|
||||
enc = CFStringGetSystemEncoding();
|
||||
break ;
|
||||
|
||||
case wxFONTENCODING_ISO8859_1 :
|
||||
enc = kCFStringEncodingISOLatin1 ;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_2 :
|
||||
enc = kCFStringEncodingISOLatin2;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_3 :
|
||||
enc = kCFStringEncodingISOLatin3 ;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_4 :
|
||||
enc = kCFStringEncodingISOLatin4;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_5 :
|
||||
enc = kCFStringEncodingISOLatinCyrillic;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_6 :
|
||||
enc = kCFStringEncodingISOLatinArabic;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_7 :
|
||||
enc = kCFStringEncodingISOLatinGreek;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_8 :
|
||||
enc = kCFStringEncodingISOLatinHebrew;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_9 :
|
||||
enc = kCFStringEncodingISOLatin5;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_10 :
|
||||
enc = kCFStringEncodingISOLatin6;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_11 :
|
||||
enc = kCFStringEncodingISOLatinThai;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_13 :
|
||||
enc = kCFStringEncodingISOLatin7;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_14 :
|
||||
enc = kCFStringEncodingISOLatin8;
|
||||
break ;
|
||||
case wxFONTENCODING_ISO8859_15 :
|
||||
enc = kCFStringEncodingISOLatin9;
|
||||
break ;
|
||||
|
||||
case wxFONTENCODING_KOI8 :
|
||||
enc = kCFStringEncodingKOI8_R;
|
||||
break ;
|
||||
case wxFONTENCODING_ALTERNATIVE : // MS-DOS CP866
|
||||
enc = kCFStringEncodingDOSRussian;
|
||||
break ;
|
||||
|
||||
// case wxFONTENCODING_BULGARIAN :
|
||||
// enc = ;
|
||||
// break ;
|
||||
|
||||
case wxFONTENCODING_CP437 :
|
||||
enc = kCFStringEncodingDOSLatinUS ;
|
||||
break ;
|
||||
case wxFONTENCODING_CP850 :
|
||||
enc = kCFStringEncodingDOSLatin1;
|
||||
break ;
|
||||
case wxFONTENCODING_CP852 :
|
||||
enc = kCFStringEncodingDOSLatin2;
|
||||
break ;
|
||||
case wxFONTENCODING_CP855 :
|
||||
enc = kCFStringEncodingDOSCyrillic;
|
||||
break ;
|
||||
case wxFONTENCODING_CP866 :
|
||||
enc = kCFStringEncodingDOSRussian ;
|
||||
break ;
|
||||
case wxFONTENCODING_CP874 :
|
||||
enc = kCFStringEncodingDOSThai;
|
||||
break ;
|
||||
case wxFONTENCODING_CP932 :
|
||||
enc = kCFStringEncodingDOSJapanese;
|
||||
break ;
|
||||
case wxFONTENCODING_CP936 :
|
||||
enc = kCFStringEncodingDOSChineseSimplif ;
|
||||
break ;
|
||||
case wxFONTENCODING_CP949 :
|
||||
enc = kCFStringEncodingDOSKorean;
|
||||
break ;
|
||||
case wxFONTENCODING_CP950 :
|
||||
enc = kCFStringEncodingDOSChineseTrad;
|
||||
break ;
|
||||
case wxFONTENCODING_CP1250 :
|
||||
enc = kCFStringEncodingWindowsLatin2;
|
||||
break ;
|
||||
case wxFONTENCODING_CP1251 :
|
||||
enc = kCFStringEncodingWindowsCyrillic ;
|
||||
break ;
|
||||
case wxFONTENCODING_CP1252 :
|
||||
enc = kCFStringEncodingWindowsLatin1 ;
|
||||
break ;
|
||||
case wxFONTENCODING_CP1253 :
|
||||
enc = kCFStringEncodingWindowsGreek;
|
||||
break ;
|
||||
case wxFONTENCODING_CP1254 :
|
||||
enc = kCFStringEncodingWindowsLatin5;
|
||||
break ;
|
||||
case wxFONTENCODING_CP1255 :
|
||||
enc = kCFStringEncodingWindowsHebrew ;
|
||||
break ;
|
||||
case wxFONTENCODING_CP1256 :
|
||||
enc = kCFStringEncodingWindowsArabic ;
|
||||
break ;
|
||||
case wxFONTENCODING_CP1257 :
|
||||
enc = kCFStringEncodingWindowsBalticRim;
|
||||
break ;
|
||||
// This only really encodes to UTF7 (if that) evidently
|
||||
// case wxFONTENCODING_UTF7 :
|
||||
// enc = kCFStringEncodingNonLossyASCII ;
|
||||
// break ;
|
||||
case wxFONTENCODING_UTF8 :
|
||||
enc = kCFStringEncodingUTF8 ;
|
||||
break ;
|
||||
case wxFONTENCODING_EUC_JP :
|
||||
enc = kCFStringEncodingEUC_JP;
|
||||
break ;
|
||||
/* Don't support conversion to/from UTF16 as wxWidgets can do this better.
|
||||
* In particular, ToWChar would fail miserably using strlen on an input UTF16.
|
||||
case wxFONTENCODING_UTF16 :
|
||||
enc = kCFStringEncodingUnicode ;
|
||||
break ;
|
||||
*/
|
||||
case wxFONTENCODING_MACROMAN :
|
||||
enc = kCFStringEncodingMacRoman ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACJAPANESE :
|
||||
enc = kCFStringEncodingMacJapanese ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACCHINESETRAD :
|
||||
enc = kCFStringEncodingMacChineseTrad ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACKOREAN :
|
||||
enc = kCFStringEncodingMacKorean ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACARABIC :
|
||||
enc = kCFStringEncodingMacArabic ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACHEBREW :
|
||||
enc = kCFStringEncodingMacHebrew ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACGREEK :
|
||||
enc = kCFStringEncodingMacGreek ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACCYRILLIC :
|
||||
enc = kCFStringEncodingMacCyrillic ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACDEVANAGARI :
|
||||
enc = kCFStringEncodingMacDevanagari ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACGURMUKHI :
|
||||
enc = kCFStringEncodingMacGurmukhi ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACGUJARATI :
|
||||
enc = kCFStringEncodingMacGujarati ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACORIYA :
|
||||
enc = kCFStringEncodingMacOriya ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACBENGALI :
|
||||
enc = kCFStringEncodingMacBengali ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACTAMIL :
|
||||
enc = kCFStringEncodingMacTamil ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACTELUGU :
|
||||
enc = kCFStringEncodingMacTelugu ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACKANNADA :
|
||||
enc = kCFStringEncodingMacKannada ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACMALAJALAM :
|
||||
enc = kCFStringEncodingMacMalayalam ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACSINHALESE :
|
||||
enc = kCFStringEncodingMacSinhalese ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACBURMESE :
|
||||
enc = kCFStringEncodingMacBurmese ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACKHMER :
|
||||
enc = kCFStringEncodingMacKhmer ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACTHAI :
|
||||
enc = kCFStringEncodingMacThai ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACLAOTIAN :
|
||||
enc = kCFStringEncodingMacLaotian ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACGEORGIAN :
|
||||
enc = kCFStringEncodingMacGeorgian ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACARMENIAN :
|
||||
enc = kCFStringEncodingMacArmenian ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACCHINESESIMP :
|
||||
enc = kCFStringEncodingMacChineseSimp ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACTIBETAN :
|
||||
enc = kCFStringEncodingMacTibetan ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACMONGOLIAN :
|
||||
enc = kCFStringEncodingMacMongolian ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACETHIOPIC :
|
||||
enc = kCFStringEncodingMacEthiopic ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACCENTRALEUR :
|
||||
enc = kCFStringEncodingMacCentralEurRoman ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACVIATNAMESE :
|
||||
enc = kCFStringEncodingMacVietnamese ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACARABICEXT :
|
||||
enc = kCFStringEncodingMacExtArabic ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACSYMBOL :
|
||||
enc = kCFStringEncodingMacSymbol ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACDINGBATS :
|
||||
enc = kCFStringEncodingMacDingbats ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACTURKISH :
|
||||
enc = kCFStringEncodingMacTurkish ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACCROATIAN :
|
||||
enc = kCFStringEncodingMacCroatian ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACICELANDIC :
|
||||
enc = kCFStringEncodingMacIcelandic ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACROMANIAN :
|
||||
enc = kCFStringEncodingMacRomanian ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACCELTIC :
|
||||
enc = kCFStringEncodingMacCeltic ;
|
||||
break ;
|
||||
case wxFONTENCODING_MACGAELIC :
|
||||
enc = kCFStringEncodingMacGaelic ;
|
||||
break ;
|
||||
/* CFString is known to support this back to the original CarbonLib */
|
||||
/* http://developer.apple.com/samplecode/CarbonMDEF/listing2.html */
|
||||
case wxFONTENCODING_MACKEYBOARD :
|
||||
/* We don't wish to pollute the namespace too much, even though we're a private header. */
|
||||
/* The constant is well-defined as 41 and is not expected to change. */
|
||||
enc = 41 /*kTextEncodingMacKeyboardGlyphs*/ ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
// because gcc is picky
|
||||
break ;
|
||||
}
|
||||
|
||||
return enc ;
|
||||
}
|
||||
|
||||
|
||||
class wxMBConv_cf : public wxMBConv
|
||||
{
|
||||
public:
|
||||
enum NormalizationForm
|
||||
{
|
||||
None = 0x00,
|
||||
FromWChar_D = 0x01,
|
||||
ToWChar_C = 0x02
|
||||
};
|
||||
|
||||
wxMBConv_cf()
|
||||
{
|
||||
Init(CFStringGetSystemEncoding(), ToWChar_C) ;
|
||||
}
|
||||
|
||||
wxMBConv_cf(const wxMBConv_cf& conv) : wxMBConv()
|
||||
{
|
||||
m_encoding = conv.m_encoding;
|
||||
m_normalization = conv.m_normalization;
|
||||
}
|
||||
|
||||
#if wxUSE_FONTMAP
|
||||
wxMBConv_cf(const char* name, NormalizationForm normalization = ToWChar_C)
|
||||
{
|
||||
Init( wxCFStringEncFromFontEnc(wxFontMapperBase::Get()->CharsetToEncoding(name, false) ) , normalization) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxMBConv_cf(wxFontEncoding encoding, NormalizationForm normalization = ToWChar_C )
|
||||
{
|
||||
Init( wxCFStringEncFromFontEnc(encoding) , normalization);
|
||||
}
|
||||
|
||||
virtual ~wxMBConv_cf()
|
||||
{
|
||||
}
|
||||
|
||||
void Init( CFStringEncoding encoding, NormalizationForm normalization )
|
||||
{
|
||||
m_encoding = encoding ;
|
||||
m_normalization = normalization;
|
||||
}
|
||||
|
||||
virtual size_t ToWChar(wchar_t * dst, size_t dstSize, const char * src, size_t srcSize = wxNO_LEN) const wxOVERRIDE;
|
||||
virtual size_t FromWChar(char *dst, size_t dstSize, const wchar_t *src, size_t srcSize = wxNO_LEN) const wxOVERRIDE;
|
||||
|
||||
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConv_cf(*this); }
|
||||
|
||||
bool IsOk() const
|
||||
{
|
||||
return m_encoding != kCFStringEncodingInvalidId &&
|
||||
CFStringIsEncodingAvailable(m_encoding);
|
||||
}
|
||||
|
||||
private:
|
||||
NormalizationForm m_normalization ;
|
||||
CFStringEncoding m_encoding ;
|
||||
};
|
||||
|
||||
// This "decomposing" converter is used as wxConvFileName in wxOSX.
|
||||
class wxMBConvD_cf : public wxMBConv_cf
|
||||
{
|
||||
public:
|
||||
wxMBConvD_cf(wxFontEncoding encoding) : wxMBConv_cf(encoding, (NormalizationForm) (ToWChar_C | FromWChar_D) )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// corresponding class for holding UniChars (native unicode characters)
|
||||
|
||||
class WXDLLIMPEXP_BASE wxMacUniCharBuffer
|
||||
{
|
||||
public :
|
||||
wxMacUniCharBuffer( const wxString &str ) ;
|
||||
|
||||
~wxMacUniCharBuffer() ;
|
||||
|
||||
UniCharPtr GetBuffer() ;
|
||||
|
||||
UniCharCount GetChars() ;
|
||||
|
||||
private :
|
||||
UniCharPtr m_ubuf ;
|
||||
UniCharCount m_chars ;
|
||||
};
|
||||
32
wxheaders/wx/osx/core/private/timer.h
Normal file
32
wxheaders/wx/osx/core/private/timer.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/core/private/timer.h
|
||||
// Purpose: wxTimer class based on core foundation
|
||||
// Author: Stefan Csomor
|
||||
// Created: 2008-07-16
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_CORE_PRIVATE_TIMER_H_
|
||||
#define _WX_OSX_CORE_PRIVATE_TIMER_H_
|
||||
|
||||
#include "wx/private/timer.h"
|
||||
|
||||
struct wxOSXTimerInfo;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxOSXTimerImpl : public wxTimerImpl
|
||||
{
|
||||
public:
|
||||
wxOSXTimerImpl(wxTimer *timer);
|
||||
virtual ~wxOSXTimerImpl();
|
||||
|
||||
virtual bool Start(int milliseconds = -1, bool one_shot = false) wxOVERRIDE;
|
||||
virtual void Stop() wxOVERRIDE;
|
||||
|
||||
virtual bool IsRunning() const wxOVERRIDE;
|
||||
|
||||
private:
|
||||
wxOSXTimerInfo *m_info;
|
||||
};
|
||||
|
||||
#endif // _WX_OSX_CORE_PRIVATE_TIMER_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue