]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/iphone/glcanvas.mm
adding hook, but unfortunately no solution yet for wxComboBox::SetEditable
[wxWidgets.git] / src / osx / iphone / glcanvas.mm
index 98e97dcc7942e964ab6dd9239ce6f41163639a99..0c7d8418be5a6d952f951fc6db1f992275c356e6 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
-// RCS-ID:      $Id: glcanvas.cpp 54129 2008-06-11 19:30:52Z SC $
+// RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) Stefan Csomor
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -46,6 +46,7 @@
 
 @interface wxUICustomOpenGLView : UIView
 {
 
 @interface wxUICustomOpenGLView : UIView
 {
+    CGRect oldRect;
     EAGLContext* context;
 
     /* The pixel dimensions of the backbuffer */
     EAGLContext* context;
 
     /* The pixel dimensions of the backbuffer */
@@ -61,6 +62,7 @@
 
 - (BOOL) createFramebuffer;
 - (void) destroyFramebuffer;
 
 - (BOOL) createFramebuffer;
 - (void) destroyFramebuffer;
+- (id) initWithFrame:(CGRect) rect;
 
 @end
 
 
 @end
 
     }
 }
 
     }
 }
 
+- (id) initWithFrame:(CGRect)rect
+{
+    if ( !(self=[super initWithFrame:rect]) )
+        return nil;
+    
+    oldRect = rect;
+    return self;
+}
+
 - (BOOL)isOpaque
 {
     return YES;
 - (BOOL)isOpaque
 {
     return YES;
 - (void) setContext:(EAGLContext*) ctx {
     context = ctx;
     [EAGLContext setCurrentContext:ctx];
 - (void) setContext:(EAGLContext*) ctx {
     context = ctx;
     [EAGLContext setCurrentContext:ctx];
-    [self destroyFramebuffer];
-    [self createFramebuffer];
+
+    if ( viewFramebuffer == 0 )
+    {
+        [self destroyFramebuffer];
+        [self createFramebuffer];        
+    }
+
     glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
 }
  
     glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
 }
  
     [context presentRenderbuffer:GL_RENDERBUFFER_OES];
 }
 
     [context presentRenderbuffer:GL_RENDERBUFFER_OES];
 }
 
+- (void)layoutSubviews {
+    [EAGLContext setCurrentContext:context];
+    [self destroyFramebuffer];
+    [self createFramebuffer];
+}
+
 @end
 
 
 @end
 
 
@@ -358,7 +380,7 @@ bool wxGLCanvas::Create(wxWindow *parent,
         return false;
 */
 #if USE_SEPARATE_VIEW
         return false;
 */
 #if USE_SEPARATE_VIEW
-    m_macIsUserPane = false ;
+    DontCreatePeer();
 #endif
 
     if ( !wxWindow::Create(parent, id, pos, size, style, name) )
 #endif
 
     if ( !wxWindow::Create(parent, id, pos, size, style, name) )
@@ -373,7 +395,7 @@ bool wxGLCanvas::Create(wxWindow *parent,
             [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, 
             kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
             
             [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, 
             kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
             
-    m_peer = new wxWidgetIPhoneImpl( this, v );
+    SetPeer(new wxWidgetIPhoneImpl( this, v ));
 
     MacPostControlCreate(pos, size) ;
 #endif
 
     MacPostControlCreate(pos, size) ;
 #endif
@@ -391,7 +413,7 @@ bool wxGLCanvas::SwapBuffers()
     WXGLContext context = WXGLGetCurrentContext();
     wxCHECK_MSG(context, false, wxT("should have current context"));
 
     WXGLContext context = WXGLGetCurrentContext();
     wxCHECK_MSG(context, false, wxT("should have current context"));
 
-    wxUICustomOpenGLView* v = (wxUICustomOpenGLView*) m_peer->GetWXWidget();
+    wxUICustomOpenGLView* v = (wxUICustomOpenGLView*) GetPeer()->GetWXWidget();
     [v swapBuffers];
     return true;
 }
     [v swapBuffers];
     return true;
 }