4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
30 #include "GPG_Canvas.h"
32 #include "GHOST_ISystem.h"
38 GPG_Canvas::GPG_Canvas(GHOST_IWindow* window)
39 : GPC_Canvas(0, 0), m_window(window)
44 m_window->getClientBounds(bnds);
45 this->Resize(bnds.getWidth(), bnds.getHeight());
50 GPG_Canvas::~GPG_Canvas(void)
55 void GPG_Canvas::Init()
59 GHOST_TSuccess success;
60 success = m_window->setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);
61 assert(success == GHOST_kSuccess);
65 void GPG_Canvas::SetMousePosition(int x, int y)
67 GHOST_ISystem* system = GHOST_ISystem::getSystem();
68 if (system && m_window)
70 GHOST_TInt32 gx = (GHOST_TInt32)x;
71 GHOST_TInt32 gy = (GHOST_TInt32)y;
74 m_window->clientToScreen(gx, gy, cx, cy);
75 system->setCursorPosition(cx, cy);
80 void GPG_Canvas::SetMouseState(RAS_MouseState mousestate)
87 m_window->setCursorVisibility(false);
90 m_window->setCursorShape(GHOST_kStandardCursorWait);
91 m_window->setCursorVisibility(true);
94 m_window->setCursorShape(GHOST_kStandardCursorRightArrow);
95 m_window->setCursorVisibility(true);
102 void GPG_Canvas::SwapBuffers()
106 m_window->swapBuffers();