Logo Search packages:      
Sourcecode: blender version File versions

GHOST_WindowCarbon::GHOST_WindowCarbon ( const STR_String title,
GHOST_TInt32  left,
GHOST_TInt32  top,
GHOST_TUns32  width,
GHOST_TUns32  height,
GHOST_TWindowState  state,
GHOST_TDrawingContextType  type = GHOST_kDrawingContextTypeNone,
const bool  stereoVisual = false 
)

Constructor. Creates a new window and opens it. To check if the window was created properly, use the getValid() method.

Parameters:
title The text shown in the title bar of the window.
left The coordinate of the left edge of the window.
top The coordinate of the top edge of the window.
width The width the window.
height The height the window.
state The state the window is initially opened with.
type The type of drawing context installed in this window.
stereoVisual Stereo visual for quad buffered stereo.

Definition at line 96 of file GHOST_WindowCarbon.cpp.

References activateDrawingContext(), gen2mac(), GHOST_Window::setDrawingContextType(), setTitle(), and updateDrawingContext().

  :
      GHOST_Window(title, left, top, width, height, state, GHOST_kDrawingContextTypeNone),
      m_windowRef(0),
      m_grafPtr(0),
      m_aglCtx(0),
      m_customCursor(0),
      m_fullScreenDirty(false)
{
    Str255 title255;
      OSStatus err;
      
      //fprintf(stderr," main screen top %i left %i height %i width %i\n", top, left, height, width);
      
      if (state >= 8 ) {
            state = state - 8;
            setMac_windowState(1);
      } else 
            setMac_windowState(0);

      if (state != GHOST_kWindowStateFullScreen) {
        Rect bnds = { top, left, top+height, left+width };
        Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized);
        gen2mac(title, title255);
        
            err =  ::CreateNewWindow( kDocumentWindowClass,
                                                 kWindowStandardDocumentAttributes+kWindowLiveResizeAttribute,
                                                 &bnds,
                                                 &m_windowRef);
            
            if ( err != noErr) {
                  fprintf(stderr," error creating window %i \n",err);
            } else {
                  
                  ::SetWRefCon(m_windowRef,(SInt32)this);
                  setTitle(title);
                  err = InstallWindowEventHandler (m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents,NULL,NULL); 
                  if ( err != noErr) {
                        fprintf(stderr," error creating handler %i \n",err);
                  } else {
                        //    ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
                        ::ShowWindow(m_windowRef);
                        ::MoveWindow (m_windowRef, left, top,true);
                        
                  }
            }
        if (m_windowRef) {
            m_grafPtr = ::GetWindowPort(m_windowRef);
            setDrawingContextType(type);
            updateDrawingContext();
            activateDrawingContext();
        }
            if(ugly_hack==NULL) {
                  ugly_hack= m_windowRef;
                  // when started from commandline, window remains in the back... also for play anim
                  ProcessSerialNumber psn;
                  GetCurrentProcess(&psn);
                  SetFrontProcess(&psn);
            }
    }
    else {
    /*
        Rect bnds = { top, left, top+height, left+width };
        gen2mac("", title255);
        m_windowRef = ::NewCWindow(
            nil,                                      // Storage 
            &bnds,                                          // Bounding rectangle of the window
            title255,                                 // Title of the window
            0,                                              // Window initially visible
            plainDBox,                                // procID
            (WindowRef)-1L,                           // Put window before all other windows
            0,                                              // Window has minimize box
            (SInt32)this);                            // Store a pointer to the class in the refCon
    */
        //GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n");
        setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);
        updateDrawingContext();
        activateDrawingContext();        
    }
}


Generated by  Doxygen 1.6.0   Back to index