// Author: Stefan Csomor
// Modified by:
// Created: 2008-06-20
-// RCS-ID: $Id: window.mm 48805 2007-09-19 14:52:25Z SC $
+// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC_CLASS( wxWidgetIPhoneImpl , wxWidgetImpl )
-wxWidgetIPhoneImpl::wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, bool isRootControl ) :
- wxWidgetImpl( peer, isRootControl ), m_osxView(w)
+wxWidgetIPhoneImpl::wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane ) :
+ wxWidgetImpl( peer, isRootControl, isUserPane ), m_osxView(w)
{
}
[m_osxView setFrame:r];
}
+
+
void wxWidgetIPhoneImpl::GetPosition( int &x, int &y ) const
{
CGRect r = [m_osxView frame];
bool wxWidgetIPhoneImpl::SetBackgroundStyle(wxBackgroundStyle style)
{
- [m_osxView setOpaque: (style == wxBG_STYLE_PAINT) ];
+ if ( style == wxBG_STYLE_PAINT )
+ [m_osxView setOpaque: YES ];
+ else
+ {
+ [m_osxView setOpaque: NO ];
+ m_osxView.backgroundColor = [UIColor clearColor];
+ }
+ return true;
}
void wxWidgetIPhoneImpl::SetLabel(const wxString& title, wxFontEncoding encoding)
wxCFStringRef cf( title , encoding );
[m_osxView setTitle:cf.AsNSString() forState:UIControlStateNormal ];
}
+#if 0 // nonpublic API problems
else if ( [m_osxView respondsToSelector:@selector(setStringValue:) ] )
{
wxCFStringRef cf( title , encoding );
[m_osxView setStringValue:cf.AsNSString()];
}
+#endif
}
bool wxWidgetIPhoneImpl::IsEnabled() const
{
+ UIView* targetView = m_osxView;
+ // TODO add support for documentViews
+
+ if ( [targetView respondsToSelector:@selector(isEnabled) ] )
+ return [targetView isEnabled];
+
+ return true;
}
void wxWidgetIPhoneImpl::Enable( bool enable )
{
+ UIView* targetView = m_osxView;
+ // TODO add support for documentViews
+
+ if ( [targetView respondsToSelector:@selector(setEnabled:) ] )
+ [targetView setEnabled:enable];
}
void wxWidgetIPhoneImpl::SetMinimum( wxInt32 v )
wxInt32 wxWidgetIPhoneImpl::GetMinimum() const
{
+ return 0;
}
wxInt32 wxWidgetIPhoneImpl::GetMaximum() const
{
+ return 0;
}
void wxWidgetIPhoneImpl::PulseGauge()
{
}
+float wxWidgetIPhoneImpl::GetContentScaleFactor() const
+{
+ if ( [m_osxView respondsToSelector:@selector(contentScaleFactor) ])
+ return [m_osxView contentScaleFactor];
+ else
+ return 1.0;
+}
+
void wxWidgetIPhoneImpl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack )
{
}
CGContextRef context = (CGContextRef) UIGraphicsGetCurrentContext();
CGContextSaveGState( context );
// draw background
-
+/*
CGContextSetFillColorWithColor( context, GetWXPeer()->GetBackgroundColour().GetCGColor());
CGContextFillRect(context, *rect );
-
+*/
GetWXPeer()->MacSetCGContextRef( context );
GetWXPeer()->GetUpdateRegion() =
sv.clipsToBounds = YES;
sv.contentMode = UIViewContentModeRedraw;
sv.clearsContextBeforeDrawing = NO;
- wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v );
+ wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v, false, true );
return c;
}