]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/ui.h
get the basics of a new scons build system together
[xonotic/netradiant.git] / radiant / ui.h
1 /*\r
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.\r
4 \r
5 This file is part of GtkRadiant.\r
6 \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
11 \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
16 \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
20 */\r
21 \r
22 //-----------------------------------------------------------------------------\r
23 //\r
24 // DESCRIPTION:\r
25 // headers for internal classes used in Messaging.cpp\r
26 // \r
27 \r
28 #ifndef __MESSAGING_H_\r
29 #define __MESSAGING_H_\r
30 \r
31 class CXYWndWrapper : public IXYWndWrapper\r
32 {\r
33 public:\r
34   void SnapToGrid( int x1, int y1, vec3_t pt );\r
35   VIEWTYPE GetViewType( void );\r
36 };\r
37 \r
38 // implementation of the IWindow API\r
39 class CGtkWindow : public IWindow\r
40 {\r
41   int refCount;\r
42   GtkWidget *m_pWnd;\r
43   GtkWidget *m_pGLWidget;\r
44   int m_nWidthParam,m_nHeightParam;\r
45   IWindowListener *m_pListen;\r
46   Str m_Name;\r
47 public:\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
50   {\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
53   }\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
58         void DecRef ()\r
59         { if ( --refCount <= 0 )\r
60                 delete this;\r
61         }\r
62   // IWindow --------------------------------------------\r
63   // get pixel size\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
73   bool Show();\r
74   // CGtkWindow -----------------------------------------\r
75   // called upon a closure of the widget\r
76   void Close();\r
77   // called to manage GL context and buffer swapping before display\r
78   void DoExpose();\r
79   // commands -------------------------------------------\r
80   // call this to ask for a Redraw\r
81   void Redraw();\r
82 };\r
83 \r
84 #endif\r