X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=radiant%2Ftextureentry.cpp;h=6e6e9de827e69f1721cb0f9d037494e8c60d299e;hp=781dcbe44ca8c96c3e4f233bdfbbec430dbd5e93;hb=6e9818d9cddf3880d001a544770c8c2c5187676f;hpb=e4287c28bb2dafedc81c66e63951d947cfbeb225 diff --git a/radiant/textureentry.cpp b/radiant/textureentry.cpp index 781dcbe4..6e6e9de8 100644 --- a/radiant/textureentry.cpp +++ b/radiant/textureentry.cpp @@ -20,3 +20,53 @@ */ #include "textureentry.h" + +#include + +template +void EntryCompletion::connect(ui::Entry entry) +{ + if (!m_store) { + m_store = ui::ListStore(gtk_list_store_new(1, G_TYPE_STRING)); + + fill(); + + StringList().connect(IdleDraw::QueueDrawCaller(m_idleUpdate)); + } + + auto completion = ui::EntryCompletion(gtk_entry_completion_new()); + gtk_entry_set_completion(entry, completion); + gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(m_store)); + gtk_entry_completion_set_text_column(completion, 0); +} + +template +void EntryCompletion::append(const char *string) +{ + m_store.append(0, string); +} + +template +void EntryCompletion::fill() +{ + StringList().forEach(AppendCaller(*this)); +} + +template +void EntryCompletion::clear() +{ + m_store.clear(); +} + +template +void EntryCompletion::update() +{ + clear(); + fill(); +} + +template +class EntryCompletion; + +template +class EntryCompletion;