2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
22 //-----------------------------------------------------------------------------
\r
25 // headers for internal classes used in Messaging.cpp
\r
28 #ifndef __MESSAGING_H_
\r
29 #define __MESSAGING_H_
\r
31 class CXYWndWrapper : public IXYWndWrapper
\r
34 void SnapToGrid( int x1, int y1, vec3_t pt );
\r
35 VIEWTYPE GetViewType( void );
\r
38 // implementation of the IWindow API
\r
39 class CGtkWindow : public IWindow
\r
43 GtkWidget *m_pGLWidget;
\r
44 int m_nWidthParam,m_nHeightParam;
\r
45 IWindowListener *m_pListen;
\r
48 CGtkWindow() { refCount = 0; m_pWnd = NULL; m_pGLWidget = NULL; m_nWidthParam = 0; m_nHeightParam = 0; m_pListen = 0; m_Name = "CGtkWindow"; }
\r
49 virtual ~CGtkWindow()
\r
51 if (m_pListen) { m_pListen->DecRef(); m_pListen = NULL; }
\r
52 if (m_pWnd) { gtk_widget_destroy(m_pWnd); m_pWnd = NULL; }
\r
54 // refcounting ----------------------------------------
\r
55 // Increment the number of references to this object
\r
56 void IncRef () { refCount++; }
\r
57 // Decrement the reference count
\r
59 { if ( --refCount <= 0 )
\r
62 // IWindow --------------------------------------------
\r
64 int getHeight() { return m_pWnd->allocation.height; }
\r
65 int getWidth() { return m_pWnd->allocation.width; }
\r
66 // set pixel size and other parameters before showing it
\r
67 void setSizeParm(int width, int height) { m_nWidthParam = width; m_nHeightParam = height; }
\r
68 // set the IWindowListener (implemented by the plugin using this window)
\r
69 void setListener(IWindowListener * pListen) { m_pListen = pListen; m_pListen->IncRef(); }
\r
70 // set the name (optional)
\r
71 void setName(char *name) { m_Name = name; }
\r
72 // will actually create the GL and the window based on the parameters
\r
74 // CGtkWindow -----------------------------------------
\r
75 // called upon a closure of the widget
\r
77 // called to manage GL context and buffer swapping before display
\r
79 // commands -------------------------------------------
\r
80 // call this to ask for a Redraw
\r