Merge branch 'master' of https://github.com/wxWidgets/wxWidgets
This commit is contained in:
@@ -2943,6 +2943,7 @@ typedef const void * CFTypeRef;
|
|||||||
|
|
||||||
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString )
|
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString )
|
||||||
typedef struct __CFString * CFMutableStringRef;
|
typedef struct __CFString * CFMutableStringRef;
|
||||||
|
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFDictionary )
|
||||||
|
|
||||||
DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource )
|
DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource )
|
||||||
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont )
|
DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont )
|
||||||
|
@@ -414,7 +414,7 @@ public:
|
|||||||
// Header attributes support: only implemented in wxMSW currently.
|
// Header attributes support: only implemented in wxMSW currently.
|
||||||
virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr)) { return false; }
|
virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr)) { return false; }
|
||||||
|
|
||||||
// Checkboxes support: only implemented in wxMSW currently.
|
// Checkboxes support.
|
||||||
virtual bool HasCheckBoxes() const { return false; }
|
virtual bool HasCheckBoxes() const { return false; }
|
||||||
virtual bool EnableCheckBoxes(bool WXUNUSED(enable) = true) { return false; }
|
virtual bool EnableCheckBoxes(bool WXUNUSED(enable) = true) { return false; }
|
||||||
virtual bool IsItemChecked(long WXUNUSED(item)) const { return false; }
|
virtual bool IsItemChecked(long WXUNUSED(item)) const { return false; }
|
||||||
|
@@ -144,6 +144,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
CTFontRef OSXGetCTFont() const;
|
CTFontRef OSXGetCTFont() const;
|
||||||
|
CFDictionaryRef OSXGetCTFontAttributes() const;
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
WX_NSFont OSXGetNSFont() const;
|
WX_NSFont OSXGetNSFont() const;
|
||||||
|
@@ -1530,8 +1530,12 @@ public:
|
|||||||
virtual bool OnSaveModified();
|
virtual bool OnSaveModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Removes the view from the document's list of views, and calls
|
Removes the view from the document's list of views.
|
||||||
OnChangedViewList().
|
|
||||||
|
If the view was really removed, also calls OnChangedViewList().
|
||||||
|
|
||||||
|
@return @true if the view was removed or @false if the document didn't
|
||||||
|
have this view in the first place.
|
||||||
*/
|
*/
|
||||||
virtual bool RemoveView(wxView* view);
|
virtual bool RemoveView(wxView* view);
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
* Template for the set.h file for VMS *
|
* Template for the set.h file for VMS *
|
||||||
* Created from setup.h_in *
|
* Created from setup.h_in *
|
||||||
* Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
|
* Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
|
||||||
* Date : 25 April 2017 *
|
* Date : 16 June 2017 *
|
||||||
* *
|
* *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@@ -208,6 +208,8 @@ typedef pid_t GPid;
|
|||||||
|
|
||||||
#define wxUSE_UNSAFE_WXSTRING_CONV 1
|
#define wxUSE_UNSAFE_WXSTRING_CONV 1
|
||||||
|
|
||||||
|
#define wxUSE_REPRODUCIBLE_BUILD 1
|
||||||
|
|
||||||
#ifndef wxUSE_UNICODE
|
#ifndef wxUSE_UNICODE
|
||||||
#if defined( __WXX11__ )
|
#if defined( __WXX11__ )
|
||||||
#define wxUSE_UNICODE 0
|
#define wxUSE_UNICODE 0
|
||||||
|
@@ -570,7 +570,9 @@ bool wxDocument::AddView(wxView *view)
|
|||||||
|
|
||||||
bool wxDocument::RemoveView(wxView *view)
|
bool wxDocument::RemoveView(wxView *view)
|
||||||
{
|
{
|
||||||
(void)m_documentViews.DeleteObject(view);
|
if ( !m_documentViews.DeleteObject(view) )
|
||||||
|
return false;
|
||||||
|
|
||||||
OnChangedViewList();
|
OnChangedViewList();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -153,36 +153,10 @@ bool wxGTKCairoDCImpl::DoStretchBlit(int xdest, int ydest, int dstWidth, int dst
|
|||||||
// surface and use this copy in the drawing operations.
|
// surface and use this copy in the drawing operations.
|
||||||
if ( cr == cr_src )
|
if ( cr == cr_src )
|
||||||
{
|
{
|
||||||
// Check if destination and source regions overlap.
|
// Check if destination and source regions overlap.
|
||||||
bool regOverlap;
|
|
||||||
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
|
|
||||||
if ( cairo_version() >= CAIRO_VERSION_ENCODE(1, 10, 0) )
|
|
||||||
{
|
|
||||||
cairo_rectangle_int_t rdst;
|
|
||||||
rdst.x = xdest;
|
|
||||||
rdst.y = ydest;
|
|
||||||
rdst.width = dstWidth;
|
|
||||||
rdst.height = dstHeight;
|
|
||||||
cairo_region_t* regdst = cairo_region_create_rectangle(&rdst);
|
|
||||||
|
|
||||||
cairo_rectangle_int_t rsrc;
|
|
||||||
rsrc.x = xsrc;
|
|
||||||
rsrc.y = ysrc;
|
|
||||||
rsrc.width = srcWidth;
|
|
||||||
rsrc.height = srcHeight;
|
|
||||||
cairo_region_overlap_t ov = cairo_region_contains_rectangle(regdst, &rsrc);
|
|
||||||
cairo_region_destroy(regdst);
|
|
||||||
regOverlap = (ov != CAIRO_REGION_OVERLAP_OUT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // Cairo 1.10
|
|
||||||
{
|
|
||||||
wxRect rdst(xdest, ydest, dstWidth, dstHeight);
|
|
||||||
wxRect rsrc(xsrc, ysrc, srcWidth, srcHeight);
|
|
||||||
regOverlap = rdst.Intersects(rsrc);
|
|
||||||
}
|
|
||||||
// If necessary, copy source surface to the temporary one.
|
// If necessary, copy source surface to the temporary one.
|
||||||
if ( regOverlap )
|
if (wxRect(xdest, ydest, dstWidth, dstHeight)
|
||||||
|
.Intersects(wxRect(xsrc, ysrc, srcWidth, srcHeight)))
|
||||||
{
|
{
|
||||||
const int w = cairo_image_surface_get_width(surfaceSrc);
|
const int w = cairo_image_surface_get_width(surfaceSrc);
|
||||||
const int h = cairo_image_surface_get_height(surfaceSrc);
|
const int h = cairo_image_surface_get_height(surfaceSrc);
|
||||||
@@ -247,7 +221,7 @@ bool wxGTKCairoDCImpl::DoStretchBlit(int xdest, int ydest, int dstWidth, int dst
|
|||||||
cairo_restore(cr);
|
cairo_restore(cr);
|
||||||
if ( surfaceTmp )
|
if ( surfaceTmp )
|
||||||
{
|
{
|
||||||
cairo_surface_destroy(surfaceTmp);
|
cairo_surface_destroy(surfaceTmp);
|
||||||
}
|
}
|
||||||
m_logicalFunction = rop_save;
|
m_logicalFunction = rop_save;
|
||||||
return true;
|
return true;
|
||||||
|
@@ -801,11 +801,15 @@ wxString wxWebViewWebKit::GetCurrentTitle() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wxgtk_web_resource_get_data_cb(WebKitWebResource *,
|
extern "C" {
|
||||||
|
static void wxgtk_web_resource_get_data_cb(GObject*,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GAsyncResult **res_out)
|
void* user_data)
|
||||||
{
|
{
|
||||||
*res_out = (GAsyncResult*)g_object_ref(res);
|
GAsyncResult** res_out = static_cast<GAsyncResult**>(user_data);
|
||||||
|
g_object_ref(res);
|
||||||
|
*res_out = res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxWebViewWebKit::GetPageSource() const
|
wxString wxWebViewWebKit::GetPageSource() const
|
||||||
@@ -818,7 +822,7 @@ wxString wxWebViewWebKit::GetPageSource() const
|
|||||||
|
|
||||||
GAsyncResult *result = NULL;
|
GAsyncResult *result = NULL;
|
||||||
webkit_web_resource_get_data(resource, NULL,
|
webkit_web_resource_get_data(resource, NULL,
|
||||||
(GAsyncReadyCallback)wxgtk_web_resource_get_data_cb,
|
wxgtk_web_resource_get_data_cb,
|
||||||
&result);
|
&result);
|
||||||
|
|
||||||
GMainContext *main_context = g_main_context_get_thread_default();
|
GMainContext *main_context = g_main_context_get_thread_default();
|
||||||
@@ -827,8 +831,9 @@ wxString wxWebViewWebKit::GetPageSource() const
|
|||||||
g_main_context_iteration(main_context, TRUE);
|
g_main_context_iteration(main_context, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t length;
|
||||||
guchar *source = webkit_web_resource_get_data_finish(resource, result,
|
guchar *source = webkit_web_resource_get_data_finish(resource, result,
|
||||||
NULL, NULL);
|
&length, NULL);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
g_object_unref(result);
|
g_object_unref(result);
|
||||||
@@ -836,7 +841,7 @@ wxString wxWebViewWebKit::GetPageSource() const
|
|||||||
|
|
||||||
if (source)
|
if (source)
|
||||||
{
|
{
|
||||||
wxString wxs = wxString(source, wxConvUTF8);
|
wxString wxs(source, wxConvUTF8, length);
|
||||||
free(source);
|
free(source);
|
||||||
return wxs;
|
return wxs;
|
||||||
}
|
}
|
||||||
|
@@ -510,10 +510,10 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
::GetClientRect(GetHwnd(), &rc);
|
::GetClientRect(GetHwnd(), &rc);
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
// No need to do anything if the client rectangle is empty and, worse,
|
// No need to do anything if the client rectangle is empty and, worse,
|
||||||
// doing it would result in an assert when creating the bitmap below.
|
// doing it would result in an assert when creating the bitmap below.
|
||||||
if ( !rc.right || !rc.bottom )
|
if ( !rc.right || !rc.bottom )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// draw the entire box in a memory DC
|
// draw the entire box in a memory DC
|
||||||
wxMemoryDC memdc(&dc);
|
wxMemoryDC memdc(&dc);
|
||||||
|
@@ -158,6 +158,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
bool m_fontValid;
|
bool m_fontValid;
|
||||||
wxCFRef<CTFontRef> m_ctFont;
|
wxCFRef<CTFontRef> m_ctFont;
|
||||||
|
wxCFRef<CFDictionaryRef> m_ctFontAttributes;
|
||||||
wxCFRef<CGFontRef> m_cgFont;
|
wxCFRef<CGFontRef> m_cgFont;
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
WX_NSFont m_nsFont;
|
WX_NSFont m_nsFont;
|
||||||
@@ -176,6 +177,7 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data) : wxGDIRefData()
|
|||||||
m_info = data.m_info;
|
m_info = data.m_info;
|
||||||
m_fontValid = data.m_fontValid;
|
m_fontValid = data.m_fontValid;
|
||||||
m_ctFont = data.m_ctFont;
|
m_ctFont = data.m_ctFont;
|
||||||
|
m_ctFontAttributes = data.m_ctFontAttributes;
|
||||||
m_cgFont = data.m_cgFont;
|
m_cgFont = data.m_cgFont;
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
m_nsFont = (NSFont*) wxMacCocoaRetain(data.m_nsFont);
|
m_nsFont = (NSFont*) wxMacCocoaRetain(data.m_nsFont);
|
||||||
@@ -271,6 +273,11 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_ctFont.reset(CTFontCreateUIFontForLanguage( uifont, (CGFloat) size, NULL ));
|
m_ctFont.reset(CTFontCreateUIFontForLanguage( uifont, (CGFloat) size, NULL ));
|
||||||
|
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||||
|
m_ctFontAttributes.reset(dict);
|
||||||
|
CFDictionarySetValue(dict, kCTFontAttributeName, m_ctFont.get() );
|
||||||
|
CFDictionarySetValue(dict, kCTForegroundColorFromContextAttributeName, kCFBooleanTrue);
|
||||||
|
|
||||||
wxCFRef<CTFontDescriptorRef> descr;
|
wxCFRef<CTFontDescriptorRef> descr;
|
||||||
descr.reset( CTFontCopyFontDescriptor( m_ctFont ) );
|
descr.reset( CTFontCopyFontDescriptor( m_ctFont ) );
|
||||||
m_info.Init(descr);
|
m_info.Init(descr);
|
||||||
@@ -288,6 +295,16 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size)
|
|||||||
|
|
||||||
static const CGAffineTransform kSlantTransform = CGAffineTransformMake( 1, 0, tan(wxDegToRad(11)), 1, 0, 0 );
|
static const CGAffineTransform kSlantTransform = CGAffineTransformMake( 1, 0, tan(wxDegToRad(11)), 1, 0, 0 );
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
struct CachedFontEntry {
|
||||||
|
wxCFRef< CTFontRef > font;
|
||||||
|
wxCFRef< CFDictionaryRef > fontAttributes;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
void wxFontRefData::MacFindFont()
|
void wxFontRefData::MacFindFont()
|
||||||
{
|
{
|
||||||
if ( m_fontValid )
|
if ( m_fontValid )
|
||||||
@@ -306,10 +323,19 @@ void wxFontRefData::MacFindFont()
|
|||||||
// use font caching
|
// use font caching
|
||||||
wxString lookupnameWithSize = wxString::Format( "%s_%u_%d", m_info.m_faceName, traits, m_info.m_pointSize );
|
wxString lookupnameWithSize = wxString::Format( "%s_%u_%d", m_info.m_faceName, traits, m_info.m_pointSize );
|
||||||
|
|
||||||
static std::map< std::wstring , wxCFRef< CTFontRef > > fontcache ;
|
static std::map< wxString, CachedFontEntry > fontcache ;
|
||||||
m_ctFont = fontcache[ std::wstring(lookupnameWithSize.wc_str()) ];
|
|
||||||
if ( !m_ctFont )
|
CachedFontEntry& entry = fontcache[ lookupnameWithSize ];
|
||||||
|
m_ctFont = entry.font;
|
||||||
|
m_ctFontAttributes = entry.fontAttributes;
|
||||||
|
if ( m_ctFont )
|
||||||
{
|
{
|
||||||
|
// use cached version
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||||
|
m_ctFontAttributes.reset(dict);
|
||||||
|
|
||||||
wxStringToStringHashMap::const_iterator it = gs_FontFamilyToPSName.find(m_info.m_faceName);
|
wxStringToStringHashMap::const_iterator it = gs_FontFamilyToPSName.find(m_info.m_faceName);
|
||||||
|
|
||||||
@@ -350,12 +376,24 @@ void wxFontRefData::MacFindFont()
|
|||||||
fontWithTraits = CTFontCreateCopyWithSymbolicTraits( m_ctFont, 0, remainingTransform, remainingTraits, remainingTraits );
|
fontWithTraits = CTFontCreateCopyWithSymbolicTraits( m_ctFont, 0, remainingTransform, remainingTraits, remainingTraits );
|
||||||
if ( fontWithTraits == NULL )
|
if ( fontWithTraits == NULL )
|
||||||
{
|
{
|
||||||
// give in on the bold, try native oblique
|
// try native oblique, emulate bold later
|
||||||
fontWithTraits = CTFontCreateCopyWithSymbolicTraits( m_ctFont, 0, NULL, kCTFontItalicTrait, kCTFontItalicTrait );
|
fontWithTraits = CTFontCreateCopyWithSymbolicTraits( m_ctFont, 0, NULL, kCTFontItalicTrait, kCTFontItalicTrait );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remainingTraits &= ~kCTFontBoldTrait;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we have to emulate bold
|
||||||
|
if ( remainingTraits & kCTFontBoldTrait )
|
||||||
|
{
|
||||||
|
// 3 times as thick, negative value because we want effect on stroke and fill (not only stroke)
|
||||||
|
const float strokewidth = -3.0;
|
||||||
|
CFDictionarySetValue(dict, kCTStrokeWidthAttributeName, CFNumberCreate( NULL, kCFNumberFloatType, &strokewidth));
|
||||||
|
}
|
||||||
|
|
||||||
if ( fontWithTraits == NULL )
|
if ( fontWithTraits == NULL )
|
||||||
{
|
{
|
||||||
fontWithTraits = CTFontCreateCopyWithAttributes( m_ctFont, m_info.m_pointSize, remainingTransform, NULL );
|
fontWithTraits = CTFontCreateCopyWithAttributes( m_ctFont, m_info.m_pointSize, remainingTransform, NULL );
|
||||||
@@ -366,6 +404,11 @@ void wxFontRefData::MacFindFont()
|
|||||||
m_ctFont.reset(fontWithTraits);
|
m_ctFont.reset(fontWithTraits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CFDictionarySetValue(dict, kCTFontAttributeName, m_ctFont.get() );
|
||||||
|
CFDictionarySetValue(dict, kCTForegroundColorFromContextAttributeName, kCFBooleanTrue);
|
||||||
|
|
||||||
|
entry.font = m_ctFont;
|
||||||
|
entry.fontAttributes = m_ctFontAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cgFont.reset(CTFontCopyGraphicsFont(m_ctFont, NULL));
|
m_cgFont.reset(CTFontCopyGraphicsFont(m_ctFont, NULL));
|
||||||
@@ -659,6 +702,16 @@ CTFontRef wxFont::OSXGetCTFont() const
|
|||||||
return (CTFontRef)(M_FONTDATA->m_ctFont);
|
return (CTFontRef)(M_FONTDATA->m_ctFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFDictionaryRef wxFont::OSXGetCTFontAttributes() const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
|
||||||
|
|
||||||
|
// cast away constness otherwise lazy font resolution is not possible
|
||||||
|
const_cast<wxFont *>(this)->RealizeResource();
|
||||||
|
|
||||||
|
return (CFDictionaryRef)(M_FONTDATA->m_ctFontAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
|
|
||||||
CGFontRef wxFont::OSXGetCGFont() const
|
CGFontRef wxFont::OSXGetCGFont() const
|
||||||
|
@@ -824,6 +824,7 @@ public:
|
|||||||
~wxMacCoreGraphicsFontData();
|
~wxMacCoreGraphicsFontData();
|
||||||
|
|
||||||
CTFontRef OSXGetCTFont() const { return m_ctFont ; }
|
CTFontRef OSXGetCTFont() const { return m_ctFont ; }
|
||||||
|
CFDictionaryRef OSXGetCTFontAttributes() const { return m_ctFontAttributes; }
|
||||||
wxColour GetColour() const { return m_colour ; }
|
wxColour GetColour() const { return m_colour ; }
|
||||||
|
|
||||||
bool GetUnderlined() const { return m_underlined ; }
|
bool GetUnderlined() const { return m_underlined ; }
|
||||||
@@ -837,6 +838,7 @@ private :
|
|||||||
bool m_underlined,
|
bool m_underlined,
|
||||||
m_strikethrough;
|
m_strikethrough;
|
||||||
wxCFRef< CTFontRef > m_ctFont;
|
wxCFRef< CTFontRef > m_ctFont;
|
||||||
|
wxCFRef< CFDictionaryRef > m_ctFontAttributes;
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
UIFont* m_uiFont;
|
UIFont* m_uiFont;
|
||||||
#endif
|
#endif
|
||||||
@@ -849,6 +851,7 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
|
|||||||
m_strikethrough = font.GetStrikethrough();
|
m_strikethrough = font.GetStrikethrough();
|
||||||
|
|
||||||
m_ctFont.reset( wxMacCreateCTFont( font ) );
|
m_ctFont.reset( wxMacCreateCTFont( font ) );
|
||||||
|
m_ctFontAttributes.reset( wxCFRetain( font.OSXGetCTFontAttributes() ) );
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
m_uiFont = CreateUIFont(font);
|
m_uiFont = CreateUIFont(font);
|
||||||
wxMacCocoaRetain( m_uiFont );
|
wxMacCocoaRetain( m_uiFont );
|
||||||
@@ -2220,21 +2223,10 @@ void wxMacCoreGraphicsContext::DoDrawText( const wxString &str, wxDouble x, wxDo
|
|||||||
|
|
||||||
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
|
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
|
||||||
wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
|
wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
|
||||||
CTFontRef font = fref->OSXGetCTFont();
|
|
||||||
CGColorRef col = wxMacCreateCGColor( fref->GetColour() );
|
CGColorRef col = wxMacCreateCGColor( fref->GetColour() );
|
||||||
#if 0
|
CTFontRef font = fref->OSXGetCTFont();
|
||||||
// right now there's no way to get continuous underlines, only words, so we emulate it
|
|
||||||
CTUnderlineStyle ustyle = fref->GetUnderlined() ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone ;
|
wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, fref->OSXGetCTFontAttributes()) );
|
||||||
wxCFRef<CFNumberRef> underlined( CFNumberCreate(NULL, kCFNumberSInt32Type, &ustyle) );
|
|
||||||
CFStringRef keys[] = { kCTFontAttributeName , kCTForegroundColorAttributeName, kCTUnderlineStyleAttributeName };
|
|
||||||
CFTypeRef values[] = { font, col, underlined };
|
|
||||||
#else
|
|
||||||
CFStringRef keys[] = { kCTFontAttributeName , kCTForegroundColorAttributeName };
|
|
||||||
CFTypeRef values[] = { font, col };
|
|
||||||
#endif
|
|
||||||
wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
|
|
||||||
WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
|
|
||||||
wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, attributes) );
|
|
||||||
wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
|
wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
|
||||||
|
|
||||||
y += CTFontGetAscent(font);
|
y += CTFontGetAscent(font);
|
||||||
@@ -2246,6 +2238,7 @@ void wxMacCoreGraphicsContext::DoDrawText( const wxString &str, wxDouble x, wxDo
|
|||||||
CGContextScaleCTM(m_cgContext, 1, -1);
|
CGContextScaleCTM(m_cgContext, 1, -1);
|
||||||
CGContextSetTextMatrix(m_cgContext, CGAffineTransformIdentity);
|
CGContextSetTextMatrix(m_cgContext, CGAffineTransformIdentity);
|
||||||
|
|
||||||
|
CGContextSetFillColorWithColor( m_cgContext, col );
|
||||||
CTLineDraw( line, m_cgContext );
|
CTLineDraw( line, m_cgContext );
|
||||||
|
|
||||||
if ( fref->GetUnderlined() ) {
|
if ( fref->GetUnderlined() ) {
|
||||||
@@ -2316,14 +2309,10 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
|
|||||||
strToMeasure = wxS(" ");
|
strToMeasure = wxS(" ");
|
||||||
|
|
||||||
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
|
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
|
||||||
CTFontRef font = fref->OSXGetCTFont();
|
|
||||||
|
|
||||||
wxCFStringRef text(strToMeasure, wxLocale::GetSystemEncoding() );
|
wxCFStringRef text(strToMeasure, wxLocale::GetSystemEncoding() );
|
||||||
CFStringRef keys[] = { kCTFontAttributeName };
|
|
||||||
CFTypeRef values[] = { font };
|
wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, fref->OSXGetCTFontAttributes() ) );
|
||||||
wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
|
|
||||||
WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
|
|
||||||
wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, attributes) );
|
|
||||||
wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
|
wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
|
||||||
|
|
||||||
CGFloat a, d, l, w;
|
CGFloat a, d, l, w;
|
||||||
@@ -2336,7 +2325,6 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
|
|||||||
if ( height )
|
if ( height )
|
||||||
*height = a+d+l;
|
*height = a+d+l;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( descent )
|
if ( descent )
|
||||||
*descent = d;
|
*descent = d;
|
||||||
if ( externalLeading )
|
if ( externalLeading )
|
||||||
@@ -2355,14 +2343,9 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
|
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
|
||||||
CTFontRef font = fref->OSXGetCTFont();
|
|
||||||
|
|
||||||
wxCFStringRef t(text, wxLocale::GetSystemEncoding() );
|
wxCFStringRef t(text, wxLocale::GetSystemEncoding() );
|
||||||
CFStringRef keys[] = { kCTFontAttributeName };
|
wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, t, fref->OSXGetCTFontAttributes()) );
|
||||||
CFTypeRef values[] = { font };
|
|
||||||
wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
|
|
||||||
WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
|
|
||||||
wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, t, attributes) );
|
|
||||||
wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
|
wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
|
||||||
|
|
||||||
widths.reserve(text.length());
|
widths.reserve(text.length());
|
||||||
|
@@ -502,7 +502,7 @@ void wxListWidgetCocoaImpl::ListSetSelection( unsigned int n, bool select, bool
|
|||||||
// TODO
|
// TODO
|
||||||
if ( select )
|
if ( select )
|
||||||
[m_tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:n]
|
[m_tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:n]
|
||||||
byExtendingSelection:multi];
|
byExtendingSelection:multi];
|
||||||
else
|
else
|
||||||
[m_tableView deselectRow: n];
|
[m_tableView deselectRow: n];
|
||||||
|
|
||||||
|
@@ -146,19 +146,19 @@ private:
|
|||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[playerLayer release];
|
[playerLayer release];
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
|
|
||||||
[self removeObserver:self forKeyPath:@"rate" context:AVSPPlayerRateContext];
|
[self removeObserver:self forKeyPath:@"rate" context:AVSPPlayerRateContext];
|
||||||
[self removeObserver:self forKeyPath:@"currentItem.status" context:AVSPPlayerItemStatusContext];
|
[self removeObserver:self forKeyPath:@"currentItem.status" context:AVSPPlayerItemStatusContext];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||||
{
|
{
|
||||||
if (context == AVSPPlayerItemStatusContext)
|
if (context == AVSPPlayerItemStatusContext)
|
||||||
{
|
{
|
||||||
id val = [change objectForKey:NSKeyValueChangeNewKey];
|
id val = [change objectForKey:NSKeyValueChangeNewKey];
|
||||||
if ( val != [NSNull null ] )
|
if ( val != [NSNull null ] )
|
||||||
{
|
{
|
||||||
@@ -180,10 +180,10 @@ private:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (context == AVSPPlayerRateContext)
|
else if (context == AVSPPlayerRateContext)
|
||||||
{
|
{
|
||||||
NSNumber* newRate = [change objectForKey:NSKeyValueChangeNewKey];
|
NSNumber* newRate = [change objectForKey:NSKeyValueChangeNewKey];
|
||||||
if ([newRate intValue] == 0)
|
if ([newRate intValue] == 0)
|
||||||
{
|
{
|
||||||
m_backend->QueuePauseEvent();
|
m_backend->QueuePauseEvent();
|
||||||
@@ -192,11 +192,11 @@ private:
|
|||||||
{
|
{
|
||||||
m_backend->QueuePlayEvent();
|
m_backend->QueuePlayEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(wxAVMediaBackend*) backend
|
-(wxAVMediaBackend*) backend
|
||||||
@@ -220,12 +220,12 @@ private:
|
|||||||
|
|
||||||
-(BOOL)isPlaying
|
-(BOOL)isPlaying
|
||||||
{
|
{
|
||||||
if ([self rate] == 0)
|
if ([self rate] == 0)
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -252,7 +252,7 @@ private:
|
|||||||
|
|
||||||
+ (Class)layerClass
|
+ (Class)layerClass
|
||||||
{
|
{
|
||||||
return [AVPlayerLayer class];
|
return [AVPlayerLayer class];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithFrame:(CGRect)rect player:(wxAVPlayer*) player
|
- (id) initWithFrame:(CGRect)rect player:(wxAVPlayer*) player
|
||||||
@@ -500,7 +500,7 @@ bool wxAVMediaBackend::SetPlaybackRate(double dRate)
|
|||||||
|
|
||||||
bool wxAVMediaBackend::SetPosition(wxLongLong where)
|
bool wxAVMediaBackend::SetPosition(wxLongLong where)
|
||||||
{
|
{
|
||||||
[m_player seekToTime:CMTimeMakeWithSeconds(where.GetValue() / 1000.0, 1)
|
[m_player seekToTime:CMTimeMakeWithSeconds(where.GetValue() / 1000.0, 1)
|
||||||
toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];
|
toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -515,10 +515,10 @@ wxLongLong wxAVMediaBackend::GetDuration()
|
|||||||
{
|
{
|
||||||
AVPlayerItem *playerItem = [m_player currentItem];
|
AVPlayerItem *playerItem = [m_player currentItem];
|
||||||
|
|
||||||
if ([playerItem status] == AVPlayerItemStatusReadyToPlay)
|
if ([playerItem status] == AVPlayerItemStatusReadyToPlay)
|
||||||
return CMTimeGetSeconds([[playerItem asset] duration])*1000.0;
|
return CMTimeGetSeconds([[playerItem asset] duration])*1000.0;
|
||||||
else
|
else
|
||||||
return 0.f;
|
return 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMediaState wxAVMediaBackend::GetState()
|
wxMediaState wxAVMediaBackend::GetState()
|
||||||
|
@@ -239,7 +239,6 @@ protected :
|
|||||||
{
|
{
|
||||||
wxUnusedVar(textField);
|
wxUnusedVar(textField);
|
||||||
|
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,11 +720,11 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
|
|||||||
wxUITextField* v = [[wxUITextField alloc] initWithFrame:r];
|
wxUITextField* v = [[wxUITextField alloc] initWithFrame:r];
|
||||||
tv = v;
|
tv = v;
|
||||||
|
|
||||||
v.textColor = [UIColor blackColor];
|
v.textColor = [UIColor blackColor];
|
||||||
v.font = [UIFont systemFontOfSize:17.0];
|
v.font = [UIFont systemFontOfSize:17.0];
|
||||||
v.backgroundColor = [UIColor whiteColor];
|
v.backgroundColor = [UIColor whiteColor];
|
||||||
|
|
||||||
v.clearButtonMode = UITextFieldViewModeNever;
|
v.clearButtonMode = UITextFieldViewModeNever;
|
||||||
|
|
||||||
[v setBorderStyle:UITextBorderStyleBezel];
|
[v setBorderStyle:UITextBorderStyleBezel];
|
||||||
if ( style & wxNO_BORDER )
|
if ( style & wxNO_BORDER )
|
||||||
@@ -748,7 +747,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
|
|||||||
if ( !(style & wxTE_MULTILINE) )
|
if ( !(style & wxTE_MULTILINE) )
|
||||||
{
|
{
|
||||||
[tv setAutocorrectionType:UITextAutocorrectionTypeNo];
|
[tv setAutocorrectionType:UITextAutocorrectionTypeNo];
|
||||||
[tv setReturnKeyType:UIReturnKeyDone];
|
[tv setReturnKeyType:UIReturnKeyDone];
|
||||||
}
|
}
|
||||||
[tv setKeyboardType:UIKeyboardTypeDefault];
|
[tv setKeyboardType:UIKeyboardTypeDefault];
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2738,9 +2738,9 @@ void wxWidgetImpl::RemoveAssociations(wxWidgetImpl* impl)
|
|||||||
|
|
||||||
void wxWidgetImpl::RemoveAssociation(WXWidget control)
|
void wxWidgetImpl::RemoveAssociation(WXWidget control)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( control != NULL, wxT("attempt to remove a NULL WXWidget from control map") );
|
wxCHECK_RET( control != NULL, wxT("attempt to remove a NULL WXWidget from control map") );
|
||||||
|
|
||||||
wxWinMacControlList.erase(control);
|
wxWinMacControlList.erase(control);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxIMPLEMENT_ABSTRACT_CLASS(wxWidgetImpl, wxObject);
|
wxIMPLEMENT_ABSTRACT_CLASS(wxWidgetImpl, wxObject);
|
||||||
|
@@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
#if wxUSE_XRC && wxUSE_TOGGLEBTN
|
#if wxUSE_XRC && wxUSE_TOGGLEBTN
|
||||||
|
|
||||||
|
# if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !(defined(__WXGTK__) && !defined(__WXGTK20__))
|
||||||
|
# define wxHAVE_BITMAPS_IN_BUTTON 1
|
||||||
|
# endif
|
||||||
|
|
||||||
#include "wx/xrc/xh_tglbtn.h"
|
#include "wx/xrc/xh_tglbtn.h"
|
||||||
#include "wx/tglbtn.h"
|
#include "wx/tglbtn.h"
|
||||||
#include "wx/button.h" // solely for wxBU_EXACTFIT
|
#include "wx/button.h" // solely for wxBU_EXACTFIT
|
||||||
@@ -35,7 +39,7 @@ wxObject *wxToggleButtonXmlHandler::DoCreateResource()
|
|||||||
|
|
||||||
wxObject *control = m_instance;
|
wxObject *control = m_instance;
|
||||||
|
|
||||||
#if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !(defined(__WXGTK__) && !defined(__WXGTK20__))
|
#ifdef wxHAVE_BITMAPS_IN_BUTTON
|
||||||
|
|
||||||
if (m_class == wxT("wxBitmapToggleButton"))
|
if (m_class == wxT("wxBitmapToggleButton"))
|
||||||
{
|
{
|
||||||
@@ -78,16 +82,18 @@ void wxToggleButtonXmlHandler::DoCreateToggleButton(wxObject *control)
|
|||||||
wxDefaultValidator,
|
wxDefaultValidator,
|
||||||
GetName());
|
GetName());
|
||||||
|
|
||||||
|
#ifdef wxHAVE_BITMAPS_IN_BUTTON
|
||||||
if ( GetParamNode("bitmap") )
|
if ( GetParamNode("bitmap") )
|
||||||
{
|
{
|
||||||
button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON),
|
button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON),
|
||||||
GetDirection("bitmapposition"));
|
GetDirection("bitmapposition"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
button->SetValue(GetBool( wxT("checked")));
|
button->SetValue(GetBool( wxT("checked")));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__WXUNIVERSAL__) && !defined(__WXMOTIF__) && !(defined(__WXGTK__) && !defined(__WXGTK20__))
|
#ifdef wxHAVE_BITMAPS_IN_BUTTON
|
||||||
void wxToggleButtonXmlHandler::DoCreateBitmapToggleButton(wxObject *control)
|
void wxToggleButtonXmlHandler::DoCreateBitmapToggleButton(wxObject *control)
|
||||||
{
|
{
|
||||||
wxBitmapToggleButton *button = wxDynamicCast(control, wxBitmapToggleButton);
|
wxBitmapToggleButton *button = wxDynamicCast(control, wxBitmapToggleButton);
|
||||||
|
Reference in New Issue
Block a user