2 Copyright (C) 2001-2006, William Joseph.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #if !defined( INCLUDED_TEXTUREENTRY_H )
23 #define INCLUDED_TEXTUREENTRY_H
25 #include "gtkutil/idledraw.h"
27 #include "generic/static.h"
28 #include "signal/isignal.h"
29 #include "shaderlib.h"
31 #include "texwindow.h"
33 template<typename StringList>
34 class EntryCompletion {
35 ui::ListStore m_store;
36 IdleDraw m_idleUpdate;
38 EntryCompletion() : m_store(0), m_idleUpdate(UpdateCaller(*this))
42 void connect(ui::Entry entry);
44 void append(const char *string);
46 typedef MemberCaller1<EntryCompletion, const char *, &EntryCompletion::append> AppendCaller;
54 typedef MemberCaller<EntryCompletion, &EntryCompletion::update> UpdateCaller;
57 class TextureNameList {
59 void forEach(const ShaderNameCallback &callback) const
61 for (QERApp_ActiveShaders_IteratorBegin(); !QERApp_ActiveShaders_IteratorAtEnd(); QERApp_ActiveShaders_IteratorIncrement()) {
62 IShader *shader = QERApp_ActiveShaders_IteratorCurrent();
64 if (shader_equal_prefix(shader->getName(), "textures/")) {
65 callback(shader->getName() + 9);
70 void connect(const SignalHandler &update) const
72 TextureBrowser_addActiveShadersChangedCallback(update);
76 typedef Static<EntryCompletion<TextureNameList> > GlobalTextureEntryCompletion;
81 void forEach(const ShaderNameCallback &callback) const
83 GlobalShaderSystem().foreachShaderName(callback);
86 void connect(const SignalHandler &update) const
88 TextureBrowser_addShadersRealiseCallback(update);
92 typedef Static<EntryCompletion<ShaderList> > GlobalShaderEntryCompletion;