Wt examples  3.3.0
/home/koen/project/wt/public-git/wt/examples/composer/ContactSuggestions.C
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
00003  *
00004  * See the LICENSE file for terms of use.
00005  */
00006 
00007 #include <boost/lexical_cast.hpp>
00008 
00009 #include "ContactSuggestions.h"
00010 #include "AddresseeEdit.h"
00011 #include "Contact.h"
00012 
00013 #include <Wt/WContainerWidget>
00014 
00015 namespace {
00016   WSuggestionPopup::Options contactOptions
00017   = { "<b>",         // highlightBeginTag
00018       "</b>",        // highlightEndTag
00019       ',',           // listSeparator
00020       " \\n",        // whitespace
00021       "-., \"@\\n;", // wordSeparators
00022       ", "           // appendReplacedText
00023     };
00024 }
00025 
00026 ContactSuggestions::ContactSuggestions(WContainerWidget *parent)
00027   : WSuggestionPopup(WSuggestionPopup::generateMatcherJS(contactOptions),
00028                      WSuggestionPopup::generateReplacerJS(contactOptions),
00029                      parent)
00030 { }
00031 
00032 void ContactSuggestions::setAddressBook(const std::vector<Contact>& contacts)
00033 {
00034   clearSuggestions();
00035 
00036   for (unsigned i = 0; i < contacts.size(); ++i)
00037     addSuggestion(contacts[i].formatted(), contacts[i].formatted());
00038 }

Generated on Mon Apr 8 2013 for the C++ Web Toolkit (Wt) by doxygen 1.7.5.1