Logo Search packages:      
Sourcecode: blender version File versions

GHOST_WindowWin32::GHOST_WindowWin32 ( 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 82 of file GHOST_WindowWin32.cpp.

References m_hDC, m_hWnd, s_windowClassName, and GHOST_Window::setDrawingContextType().

:
      GHOST_Window(title, left, top, width, height, state, GHOST_kDrawingContextTypeNone,
      stereoVisual),
      m_hDC(0),
      m_hGlRc(0),
      m_hasMouseCaptured(false),
      m_nPressedButtons(0),
      m_customCursor(0)
{
      if (state != GHOST_kWindowStateFullScreen) {
                  /* Convert client size into window size */
            width += GetSystemMetrics(SM_CXSIZEFRAME)*2;
            height += GetSystemMetrics(SM_CYSIZEFRAME)*2 + GetSystemMetrics(SM_CYCAPTION);

            m_hWnd = ::CreateWindow(
                  s_windowClassName,                  // pointer to registered class name
                  title,                                    // pointer to window name
                  WS_OVERLAPPEDWINDOW,          // window style
                  left,                               // horizontal position of window
                  top,                                // vertical position of window
                  width,                                    // window width
                  height,                                   // window height
                  0,                                        // handle to parent or owner window
                  0,                                        // handle to menu or child-window identifier
                  ::GetModuleHandle(0),         // handle to application instance
                  0);                                       // pointer to window-creation data
      }
      else {
            m_hWnd = ::CreateWindow(
                  s_windowClassName,                  // pointer to registered class name
                  title,                                    // pointer to window name
                  WS_POPUP | WS_MAXIMIZE,       // window style
                  left,                               // horizontal position of window
                  top,                                // vertical position of window
                  width,                                    // window width
                  height,                                   // window height
                  0,                                        // handle to parent or owner window
                  0,                                        // handle to menu or child-window identifier
                  ::GetModuleHandle(0),         // handle to application instance
                  0);                                       // pointer to window-creation data
      }
      if (m_hWnd) {
            // Store a pointer to this class in the window structure
            LONG result = ::SetWindowLong(m_hWnd, GWL_USERDATA, (LONG)this);

            // Store the device context
            m_hDC = ::GetDC(m_hWnd);

            // Show the window
            int nCmdShow;
            switch (state) {
                  case GHOST_kWindowStateMaximized:
                        nCmdShow = SW_SHOWMAXIMIZED;
                        break;
                  case GHOST_kWindowStateMinimized:
                        nCmdShow = SW_SHOWMINIMIZED;
                        break;
                  case GHOST_kWindowStateNormal:
                  default:
                        nCmdShow = SW_SHOWNORMAL;
                        break;
            }
            setDrawingContextType(type);
            ::ShowWindow(m_hWnd, nCmdShow);
            // Force an initial paint of the window
            ::UpdateWindow(m_hWnd);
      }
}


Generated by  Doxygen 1.6.0   Back to index