Wt examples  3.7.1
ContactSuggestions.C
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 Emweb bv, Herent, Belgium.
3  *
4  * See the LICENSE file for terms of use.
5  */
6 
7 #include <boost/lexical_cast.hpp>
8 
9 #include "ContactSuggestions.h"
10 #include "AddresseeEdit.h"
11 #include "Contact.h"
12 
13 #include <Wt/WContainerWidget>
14 
15 namespace {
16  WSuggestionPopup::Options contactOptions
17  = { "<b>", // highlightBeginTag
18  "</b>", // highlightEndTag
19  ',', // listSeparator
20  " \n", // whitespace
21  "-., \"@\n;", // wordSeparators
22  ", " // appendReplacedText
23  };
24 }
25 
27  : WSuggestionPopup(WSuggestionPopup::generateMatcherJS(contactOptions),
28  WSuggestionPopup::generateReplacerJS(contactOptions),
29  parent)
30 { }
31 
32 void ContactSuggestions::setAddressBook(const std::vector<Contact>& contacts)
33 {
35 
36  for (unsigned i = 0; i < contacts.size(); ++i)
37  addSuggestion(contacts[i].formatted(), contacts[i].formatted());
38 }
void addSuggestion(const WString &suggestionText, const WString &suggestionValue=WString::Empty)
ContactSuggestions(WObject *parent=0)
Create a new ContactSuggestions popup.
void setAddressBook(const std::vector< Contact > &contacts)
Set the address book.

Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13