Esempio n. 1
0
void wxGLCanvas::SetViewport()
{
#ifndef __LP64__
    // viewport is initially set to entire port
    // adjust glViewport to just this window
    int x = 0 ;
    int y = 0 ;

    wxWindow* iter = this ;
    while( iter->GetParent() )
    {
        iter = iter->GetParent() ;
    }

    if ( iter && iter->IsTopLevel() )
    {
        MacClientToRootWindow( &x , &y ) ;
        int width, height;
        GetClientSize(& width, & height);
        Rect bounds ;
#if 0
		// TODO in case we adopt point vs pixel coordinates, this will make the conversion
        GetWindowPortBounds( MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds ) ;
        HIRect hiRect = CGRectMake( x, y, width, height ) ;
        HIRectConvert( &hiRect, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceScreenPixel, NULL) ;
        HIRect hiBounds = CGRectMake( 0, 0, bounds.right - bounds.left , bounds.bottom - bounds.top ) ;
        HIRectConvert( &hiBounds, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceScreenPixel, NULL) ;
        GLint parms[4] ;
        parms[0] = hiRect.origin.x ;
        parms[1] = hiBounds.size.height - (hiRect.origin.y + hiRect.size.height) ;
        parms[2] = hiRect.size.width ;
        parms[3] = hiRect.size.height ;
#else
        GetWindowPortBounds( MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds ) ;
        GLint parms[4] ;
        parms[0] = x ;
        parms[1] = bounds.bottom - bounds.top - ( y + height ) ;
        parms[2] = width ;
        parms[3] = height ;
#endif
        if ( !m_macCanvasIsShown )
            parms[0] += 20000 ;
        aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
        aglUpdateContext(m_glContext->m_glContext);
   }
#endif
}
Esempio n. 2
0
void IGraphicsCarbon::ShowTooltip()
{
  HMHelpContentRec helpTag;
  helpTag.version = kMacHelpVersion;

  helpTag.tagSide = kHMInsideTopLeftCorner;
  HIRect r = CGRectMake(mGraphicsMac->GetMouseX(), mGraphicsMac->GetMouseY() + 23, 1, 1);
  HIRectConvert(&r, kHICoordSpaceView, mView, kHICoordSpaceScreenPixel, NULL);
  helpTag.absHotRect.top = (int)r.origin.y;
  helpTag.absHotRect.left = (int)r.origin.x;
  helpTag.absHotRect.bottom = helpTag.absHotRect.top + (int)r.size.height;
  helpTag.absHotRect.right = helpTag.absHotRect.left + (int)r.size.width;
  
  helpTag.content[kHMMinimumContentIndex].contentType = kHMCFStringLocalizedContent;
  CFStringRef str = CFStringCreateWithCString(NULL, mTooltip, kCFStringEncodingUTF8);
  helpTag.content[kHMMinimumContentIndex].u.tagCFString = str;
  helpTag.content[kHMMaximumContentIndex].contentType = kHMNoContent;
  HMDisplayTag(&helpTag);
  CFRelease(str);
  mShowingTooltip = true;
}