2 This file is part of GtkRadiant.
4 GtkRadiant is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 GtkRadiant is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with GtkRadiant; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include "ufoai_gtk.h"
20 #include "ufoai_filters.h"
23 #include "iscenegraph.h"
28 * GTK callback functions
33 GtkWindow* m_gtk_window;
35 UFOAIGtk(void* gtk_window) : m_gtk_window((GtkWindow*)gtk_window)
41 * @brief If you return FALSE in the "delete_event" signal handler,
42 * GTK will emit the "destroy" signal. Returning TRUE means
43 * you don't want the window to be destroyed.
44 * This is useful for popping up 'are you sure you want to quit?'
47 static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
53 * @brief destroy widget if destroy signal is passed to widget
55 static void destroy(GtkWidget *widget, gpointer data)
57 gtk_widget_destroy(widget);
61 * @brief function for close button to destroy the toplevel widget
63 static void close_window(GtkWidget *widget, gpointer data)
65 gtk_widget_destroy(gtk_widget_get_toplevel(widget));
68 /* =============================== */
70 #define NUM_TOOLBARBUTTONS 12
75 std::size_t ToolbarButtonCount(void)
77 return NUM_TOOLBARBUTTONS;
81 * @brief Used if the ufo plugin should not be visible (at least the toolbar stuff)
83 std::size_t ToolbarNoButtons (void)
91 class CUFOAIToolbarButton : public IToolbarButton
94 virtual const char* getImage() const
98 case 0: return "ufoai_level1.bmp";
99 case 1: return "ufoai_level2.bmp";
100 case 2: return "ufoai_level3.bmp";
101 case 3: return "ufoai_level4.bmp";
102 case 4: return "ufoai_level5.bmp";
103 case 5: return "ufoai_level6.bmp";
104 case 6: return "ufoai_level7.bmp";
105 case 7: return "ufoai_level8.bmp";
106 case 8: return "ufoai_stepon.bmp";
107 case 9: return "ufoai_actorclip.bmp";
108 case 10: return "ufoai_weaponclip.bmp";
109 case 11: return "ufoai_nodraw.bmp";
113 virtual EType getType() const
117 /* case 3: return eButton;*/
118 case 8: return eToggleButton;
119 case 9: return eToggleButton;
120 case 10: return eToggleButton;
121 case 11: return eToggleButton;
122 default: return eButton;
125 virtual const char* getText() const
129 case 0: return "Level 1";
130 case 1: return "Level 2";
131 case 2: return "Level 3";
132 case 3: return "Level 4";
133 case 4: return "Level 5";
134 case 5: return "Level 6";
135 case 6: return "Level 7";
136 case 7: return "Level 8";
137 case 8: return "Stepon";
138 case 9: return "Actorclip";
139 case 10: return "Weaponclip";
140 case 11: return "Nodraw";
144 virtual const char* getTooltip() const
148 case 0: return "Show only level 1";
149 case 1: return "Show only level 2";
150 case 2: return "Show only level 3";
151 case 3: return "Show only level 4";
152 case 4: return "Show only level 5";
153 case 5: return "Show only level 6";
154 case 6: return "Show only level 7";
155 case 7: return "Show only level 8";
156 case 8: return "Hide stepon brushes";
157 case 9: return "Hide actorclip brushes";
158 case 10: return "Hide weaponclip brushes";
159 case 11: return "Hide nodraw brushes";
164 virtual void activate() const
168 case 0: filter_level(CONTENTS_LEVEL1); break;
169 case 1: filter_level(CONTENTS_LEVEL2); break;
170 case 2: filter_level(CONTENTS_LEVEL3); break;
171 case 3: filter_level(CONTENTS_LEVEL4); break;
172 case 4: filter_level(CONTENTS_LEVEL5); break;
173 case 5: filter_level(CONTENTS_LEVEL6); break;
174 case 6: filter_level(CONTENTS_LEVEL7); break;
175 case 7: filter_level(CONTENTS_LEVEL8); break;
176 case 8: filter_stepon(); break;
177 case 9: filter_actorclip(); break;
178 case 10: filter_weaponclip(); break;
179 case 11: filter_nodraw(); break;
190 CUFOAIToolbarButton g_ufoaiToolbarButtons[NUM_TOOLBARBUTTONS];
195 const IToolbarButton* GetToolbarButton(std::size_t index)
197 g_ufoaiToolbarButtons[index].mIndex = index;
198 return &g_ufoaiToolbarButtons[index];
204 const IToolbarButton* GetToolbarNoButton(std::size_t index)