]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/textureentry.cpp
netradiant: strip 16-bit png to 8-bit, fix #153
[xonotic/netradiant.git] / radiant / textureentry.cpp
1 /*
2    Copyright (C) 2001-2006, William Joseph.
3    All Rights Reserved.
4
5    This file is part of GtkRadiant.
6
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.
11
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.
16
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
20  */
21
22 #include "textureentry.h"
23
24 #include <gtk/gtk.h>
25
26 template<class StringList>
27 void EntryCompletion<StringList>::connect(ui::Entry entry)
28 {
29     if (!m_store) {
30         m_store = ui::ListStore::from(gtk_list_store_new(1, G_TYPE_STRING));
31
32         fill();
33
34         StringList().connect(IdleDraw::QueueDrawCaller(m_idleUpdate));
35     }
36
37     auto completion = ui::EntryCompletion::from(gtk_entry_completion_new());
38     gtk_entry_set_completion(entry, completion);
39     gtk_entry_completion_set_model(completion, m_store);
40     gtk_entry_completion_set_text_column(completion, 0);
41 }
42
43 template<class StringList>
44 void EntryCompletion<StringList>::append(const char *string)
45 {
46     m_store.append(0, string);
47 }
48
49 template<class StringList>
50 void EntryCompletion<StringList>::fill()
51 {
52     StringList().forEach(AppendCaller(*this));
53 }
54
55 template<class StringList>
56 void EntryCompletion<StringList>::clear()
57 {
58     m_store.clear();
59 }
60
61 template<class StringList>
62 void EntryCompletion<StringList>::update()
63 {
64     clear();
65     fill();
66 }
67
68 template
69 class EntryCompletion<TextureNameList>;
70
71 template
72 class EntryCompletion<ShaderList>;