RE: I have created WLineEdit::setAutocomplete(), looking ... ยป wt-3.2.1-autocomplete-control.patch
wt-3.2.1/src/Wt/WLineEdit.C | ||
---|---|---|
: WFormWidget(parent),
|
||
textSize_(10),
|
||
maxLength_(-1),
|
||
echoMode_(Normal)
|
||
echoMode_(Normal),
|
||
autocomplete_(true)
|
||
{
|
||
setInline(true);
|
||
setFormObject(true);
|
||
... | ... | |
content_(text),
|
||
textSize_(10),
|
||
maxLength_(-1),
|
||
echoMode_(Normal)
|
||
echoMode_(Normal),
|
||
autocomplete_(true)
|
||
{
|
||
setInline(true);
|
||
setFormObject(true);
|
||
... | ... | |
}
|
||
}
|
||
void WLineEdit::setAutocomplete(bool enabled)
|
||
{
|
||
if (autocomplete_ != enabled) {
|
||
autocomplete_ = enabled;
|
||
flags_.set(BIT_AUTOCOMPLETE_CHANGED);
|
||
repaint(RepaintPropertyAttribute);
|
||
}
|
||
}
|
||
void WLineEdit::updateDom(DomElement& element, bool all)
|
||
{
|
||
if (all || flags_.test(BIT_CONTENT_CHANGED)) {
|
||
... | ... | |
flags_.reset(BIT_ECHO_MODE_CHANGED);
|
||
}
|
||
if (all || flags_.test(BIT_AUTOCOMPLETE_CHANGED)) {
|
||
if (!all || !autocomplete_) {
|
||
element.setAttribute("autocomplete", autocomplete_ == true ? "on" : "off");
|
||
}
|
||
flags_.reset(BIT_AUTOCOMPLETE_CHANGED);
|
||
}
|
||
if (all || flags_.test(BIT_TEXT_SIZE_CHANGED)) {
|
||
element.setAttribute("size",
|
||
boost::lexical_cast<std::string>(textSize_));
|
||
-- wt-3.2.1/src/Wt/WLineEdit.orig
|
||
++ wt-3.2.1/src/Wt/WLineEdit
|
||
... | ... | |
*/
|
||
EchoMode echoMode() const { return echoMode_; }
|
||
/*! \brief Sets autocomplete attribute.
|
||
*
|
||
* The default autocomplete attribute is enabled ("on").
|
||
*/
|
||
void setAutocomplete(bool enabled);
|
||
/*! \brief Returns the autocomplete attribute.
|
||
*
|
||
* \sa setAutocomplete(bool)
|
||
*/
|
||
bool autocomplete() const { return autocomplete_; }
|
||
/*! \brief Returns the current selection start.
|
||
*
|
||
* Returns -1 if there is no selected text.
|
||
... | ... | |
int textSize_;
|
||
int maxLength_;
|
||
EchoMode echoMode_;
|
||
bool autocomplete_;
|
||
static const int BIT_CONTENT_CHANGED = 0;
|
||
static const int BIT_TEXT_SIZE_CHANGED = 1;
|
||
static const int BIT_MAX_LENGTH_CHANGED = 2;
|
||
static const int BIT_ECHO_MODE_CHANGED = 3;
|
||
static const int BIT_AUTOCOMPLETE_CHANGED = 4;
|
||
std::bitset<4> flags_;
|
||
std::bitset<5> flags_;
|
||
protected:
|
||
virtual void updateDom(DomElement& element, bool all);
|